]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
ftp: avoid risk of reading uninitialized integers
authorDaniel Stenberg <daniel@haxx.se>
Thu, 17 Sep 2020 14:16:38 +0000 (16:16 +0200)
committerDaniel Stenberg <daniel@haxx.se>
Fri, 18 Sep 2020 06:26:49 +0000 (08:26 +0200)
If the received PASV response doesn't match the expected pattern, we
could end up reading uninitialized integers for IP address and port
number.

Issue pointed out by muse.dev
Closes #5972

lib/ftp.c

index 868a97a532fd31624a08a94c9e402f5f438705cb..43440139077cbfaa86c31b05436b67d4ce253342 100644 (file)
--- a/lib/ftp.c
+++ b/lib/ftp.c
@@ -1860,8 +1860,8 @@ static CURLcode ftp_state_pasv_resp(struct connectdata *conn,
   else if((ftpc->count1 == 1) &&
           (ftpcode == 227)) {
     /* positive PASV response */
-    unsigned int ip[4];
-    unsigned int port[2];
+    unsigned int ip[4] = {0, 0, 0, 0};
+    unsigned int port[2] = {0, 0};
 
     /*
      * Scan for a sequence of six comma-separated numbers and use them as