]> granicus.if.org Git - curl/commitdiff
ftp-gss: check for init before use
authorDaniel Stenberg <daniel@haxx.se>
Thu, 22 Dec 2016 23:06:25 +0000 (00:06 +0100)
committerDaniel Stenberg <daniel@haxx.se>
Sat, 24 Dec 2016 22:35:43 +0000 (23:35 +0100)
To avoid dereferencing a NULL pointer.

Reported-by: Daniel Romero
lib/security.c

index 4a8f44433fa3dd039239e375ce1e1e9fe59f543c..f4a8763413b81af56d4b8218ada48ab263e13a68 100644 (file)
@@ -367,6 +367,10 @@ int Curl_sec_read_msg(struct connectdata *conn, char *buffer,
   size_t decoded_sz = 0;
   CURLcode error;
 
+  if(!conn->mech)
+    /* not inititalized, return error */
+    return -1;
+
   DEBUGASSERT(level > PROT_NONE && level < PROT_LAST);
 
   error = Curl_base64_decode(buffer + 4, (unsigned char **)&buf, &decoded_sz);