1
0
mirror of https://github.com/moparisthebest/wget synced 2024-07-03 16:38:41 -04:00

ftp: fix invalid pointer dereference in getftp() (tiny change)

The pointer respline in use after being passed to ftp_response() may be
uninitialized if ftp_response() fails.  Ensure that respline be used
after checking the return value of ftp_response().
This commit is contained in:
Cong Ma 2014-12-15 21:21:10 +08:00 committed by Tim Rühsen
parent fcd3b3c473
commit 26790c3583

View File

@ -1350,7 +1350,6 @@ Error in server response, closing control connection.\n"));
/* Get the server to tell us if everything is retrieved. */
err = ftp_response (csock, &respline);
*last_expected_bytes = ftp_expected_bytes (respline);
if (err != FTPOK)
{
/* The control connection is decidedly closed. Print the time
@ -1366,6 +1365,7 @@ Error in server response, closing control connection.\n"));
con->csock = -1;
return FTPRETRINT;
} /* err != FTPOK */
*last_expected_bytes = ftp_expected_bytes (respline);
/* If retrieval failed for any reason, return FTPRETRINT, but do not
close socket, since the control connection is still alive. If
there is something wrong with the control connection, it will