summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2020-09-17 16:16:38 +0200
committerDaniel Stenberg <daniel@haxx.se>2020-09-17 16:16:38 +0200
commita6ffd246ec843c6c18f793173c1d1046e57cfe80 (patch)
treefea970d03ab93ec8033d46712c391f2386b32398
parentcd048aaa2838d6dbf54e19a2cdc4552ae227bf27 (diff)
downloadcurl-bagder/ftp-uninit-value.tar.gz
ftp: avoid risk of reading uninitialized integersbagder/ftp-uninit-value
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
-rw-r--r--lib/ftp.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/ftp.c b/lib/ftp.c
index d4ecf9a96..1ce3128c3 100644
--- a/lib/ftp.c
+++ b/lib/ftp.c
@@ -1864,8 +1864,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