mirror of
https://github.com/mirror/wget.git
synced 2025-02-28 21:00:25 +08:00
Bugfix: Set NULL variable due to --content-disposition to Metalink origin
* src/http.c (http_loop): Prevent SIGSEGV when hstat.local_file is NULL, opt.content_disposition has a role in leaving the value unset * src/http.c (gethttp): If hs->local_file is NULL (aka http_loop()'s hstat.local_file), set it to the value of hs->metalink->origin
This commit is contained in:
parent
c89767d8d1
commit
3021466817
@ -3378,6 +3378,9 @@ gethttp (const struct url *u, struct url *original_url, struct http_stat *hs,
|
||||
if (metalink)
|
||||
{
|
||||
hs->metalink = metalink_from_http (resp, hs, u);
|
||||
/* Bugfix: hs->local_file is NULL (opt.content_disposition). */
|
||||
if (!hs->local_file && hs->metalink && hs->metalink->origin)
|
||||
hs->local_file = xstrdup (hs->metalink->origin);
|
||||
xfree (hs->message);
|
||||
retval = RETR_WITH_METALINK;
|
||||
CLOSE_FINISH (sock);
|
||||
@ -4497,6 +4500,9 @@ exit:
|
||||
if ((ret == RETROK || opt.content_on_error) && local_file)
|
||||
{
|
||||
xfree (*local_file);
|
||||
/* Bugfix: Prevent SIGSEGV when hstat.local_file was left NULL
|
||||
(i.e. due to opt.content_disposition). */
|
||||
if (hstat.local_file)
|
||||
*local_file = xstrdup (hstat.local_file);
|
||||
}
|
||||
free_hstat (&hstat);
|
||||
|
Loading…
Reference in New Issue
Block a user