[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Bug-wget] [PATCH 25/27] Bugfix: Set NULL variable due to --content-disp
From: |
Matthew White |
Subject: |
[Bug-wget] [PATCH 25/27] Bugfix: Set NULL variable due to --content-disposition to Metalink origin |
Date: |
Thu, 29 Sep 2016 06:03:05 +0200 |
* 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
---
src/http.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/src/http.c b/src/http.c
index 4466b31..8fdf49d 100644
--- a/src/http.c
+++ b/src/http.c
@@ -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,7 +4500,10 @@ exit:
if ((ret == RETROK || opt.content_on_error) && local_file)
{
xfree (*local_file);
- *local_file = xstrdup (hstat.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);
--
2.7.3
- [Bug-wget] [PATCH 18/27] New test: Metalink shall not concatenate '/' to an empty directory prefix, (continued)
- [Bug-wget] [PATCH 18/27] New test: Metalink shall not concatenate '/' to an empty directory prefix, Matthew White, 2016/09/29
- [Bug-wget] [PATCH 19/27] New: Parse Metalink/HTTP header for application/metalink4+xml, Matthew White, 2016/09/29
- [Bug-wget] [PATCH 20/27] Bugfix: Prevent sorting when there are less than two elements, Matthew White, 2016/09/29
- [Bug-wget] [PATCH 13/27] New: Metalink/XML and Metalink/HTTP file naming safety rules, Matthew White, 2016/09/29
- [Bug-wget] [PATCH 23/27] Bugfix: Detect when a metalink:file doesn't have any hash, Matthew White, 2016/09/29
- [Bug-wget] [PATCH 22/27] Bugfix: Detect malformed base64 Metalink/HTTP Digest header, Matthew White, 2016/09/29
- [Bug-wget] [PATCH 21/27] New option --metalink-index to process Metalink application/metalink4+xml, Matthew White, 2016/09/29
- [Bug-wget] [PATCH 25/27] Bugfix: Set NULL variable due to --content-disposition to Metalink origin,
Matthew White <=
- [Bug-wget] [PATCH 24/27] New: --trust-server-names saves Metalink/HTTP xml files using the "name" field, Matthew White, 2016/09/29
- [Bug-wget] [PATCH 26/27] New: --metalink-over-http Content-Type/Disposition Metalink/XML processing, Matthew White, 2016/09/29
- [Bug-wget] [PATCH 27/27] New: Metalink/XML v3 python class, update tests to use this class, Matthew White, 2016/09/29
- Re: [Bug-wget] [PATCH v2 01/27] new Metalink functionalities, Giuseppe Scrivano, 2016/09/29