ftp: avoid risk of reading uninitialized integers

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
This commit is contained in:
Daniel Stenberg 2020-09-17 16:16:38 +02:00
Родитель 7921b41ce1
Коммит 3d8731c8f5
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 5CC908FDB71E12C2
1 изменённых файлов: 2 добавлений и 2 удалений

Просмотреть файл

@ -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