mirror of
https://github.com/mirror/wget.git
synced 2025-01-05 09:50:27 +08:00
fix segfault in ftp.c (ftp_loop_internal)
This commit is contained in:
parent
7f43748544
commit
4df7703d62
@ -1,3 +1,9 @@
|
|||||||
|
2013-06-19 Tim Ruehsen <tim.ruehsen@gmx.de>
|
||||||
|
|
||||||
|
* connect.c (socket_ip_address): zero out ip address structure to
|
||||||
|
avoid access to uninitialized values by inet_ntop().
|
||||||
|
* ftp.c (ftp_loop_internal): fix segfault caused by warc_tmp NULL pointer.
|
||||||
|
|
||||||
2013-05-21 Ray Satiro <raysatiro@yahoo.com>
|
2013-05-21 Ray Satiro <raysatiro@yahoo.com>
|
||||||
|
|
||||||
* url.c (url_file_name): Use MAX_PATH in Windows.
|
* url.c (url_file_name): Use MAX_PATH in Windows.
|
||||||
|
@ -559,6 +559,7 @@ socket_ip_address (int sock, ip_address *ip, int endpoint)
|
|||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
memset(ip, 0, sizeof(ip_address));
|
||||||
ip->family = sockaddr->sa_family;
|
ip->family = sockaddr->sa_family;
|
||||||
switch (sockaddr->sa_family)
|
switch (sockaddr->sa_family)
|
||||||
{
|
{
|
||||||
|
30
src/ftp.c
30
src/ftp.c
@ -1449,21 +1449,6 @@ ftp_loop_internal (struct url *u, struct fileinfo *f, ccon *con, char **local_fi
|
|||||||
|
|
||||||
orig_lp = con->cmd & LEAVE_PENDING ? 1 : 0;
|
orig_lp = con->cmd & LEAVE_PENDING ? 1 : 0;
|
||||||
|
|
||||||
/* For file RETR requests, we can write a WARC record.
|
|
||||||
We record the file contents to a temporary file. */
|
|
||||||
if (warc_enabled && (con->cmd & DO_RETR))
|
|
||||||
{
|
|
||||||
warc_tmp = warc_tempfile ();
|
|
||||||
if (warc_tmp == NULL)
|
|
||||||
return WARC_TMP_FOPENERR;
|
|
||||||
|
|
||||||
if (!con->proxy && con->csock != -1)
|
|
||||||
{
|
|
||||||
warc_ip = (ip_address *) alloca (sizeof (ip_address));
|
|
||||||
socket_ip_address (con->csock, warc_ip, ENDPOINT_PEER);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* THE loop. */
|
/* THE loop. */
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
@ -1491,6 +1476,21 @@ ftp_loop_internal (struct url *u, struct fileinfo *f, ccon *con, char **local_fi
|
|||||||
con->cmd |= DO_CWD;
|
con->cmd |= DO_CWD;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* For file RETR requests, we can write a WARC record.
|
||||||
|
We record the file contents to a temporary file. */
|
||||||
|
if (warc_enabled && (con->cmd & DO_RETR) && warc_tmp == NULL)
|
||||||
|
{
|
||||||
|
warc_tmp = warc_tempfile ();
|
||||||
|
if (warc_tmp == NULL)
|
||||||
|
return WARC_TMP_FOPENERR;
|
||||||
|
|
||||||
|
if (!con->proxy && con->csock != -1)
|
||||||
|
{
|
||||||
|
warc_ip = (ip_address *) alloca (sizeof (ip_address));
|
||||||
|
socket_ip_address (con->csock, warc_ip, ENDPOINT_PEER);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* Decide whether or not to restart. */
|
/* Decide whether or not to restart. */
|
||||||
if (con->cmd & DO_LIST)
|
if (con->cmd & DO_LIST)
|
||||||
restval = 0;
|
restval = 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user