wget/wget-1.17-Fix-SIGSEGV-in-N-content-disposition-combination.patch
Tomas Hozza 1db9c7d0c2 Updated to 1.17
Signed-off-by: Tomas Hozza <thozza@redhat.com>
2015-11-27 14:46:36 +01:00

63 lines
2.1 KiB
Diff

From 218d81f6e5fb4f5ecd8db0fb2d9091ea509e0475 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Tim=20R=C3=BChsen?= <tim.ruehsen@gmx.de>
Date: Sat, 21 Nov 2015 21:44:11 +0100
Subject: [PATCH] Fix SIGSEGV in -N / --content-disposition combination
* src/http.c (http_loop): Fix SIGSEGV
Reported-by: "Schleusener, Jens" <Jens.Schleusener@t-online.de>
---
src/http.c | 12 ++----------
1 file changed, 2 insertions(+), 10 deletions(-)
diff --git a/src/http.c b/src/http.c
index 355ff53..9d71483 100644
--- a/src/http.c
+++ b/src/http.c
@@ -3794,7 +3794,6 @@ http_loop (struct url *u, struct url *original_url, char **newloc,
struct http_stat hstat; /* HTTP status */
struct_stat st;
bool send_head_first = true;
- char *file_name;
bool force_full_retrieve = false;
@@ -3864,11 +3863,6 @@ http_loop (struct url *u, struct url *original_url, char **newloc,
if (opt.content_disposition && opt.always_rest)
send_head_first = true;
- if (!opt.output_document)
- file_name = url_file_name (opt.trustservernames ? u : original_url, NULL);
- else
- file_name = xstrdup (opt.output_document);
-
#ifdef HAVE_METALINK
if (opt.metalink_over_http)
{
@@ -3881,7 +3875,7 @@ http_loop (struct url *u, struct url *original_url, char **newloc,
{
/* Use conditional get request if requested
* and if timestamp is known at this moment. */
- if (opt.if_modified_since && file_exists_p (file_name) && !send_head_first)
+ if (opt.if_modified_since && !send_head_first && got_name && file_exists_p (hstat.local_file))
{
*dt |= IF_MODIFIED_SINCE;
{
@@ -3892,12 +3886,10 @@ http_loop (struct url *u, struct url *original_url, char **newloc,
}
/* Send preliminary HEAD request if -N is given and we have existing
* destination file or content disposition is enabled. */
- else if (file_exists_p (file_name) || opt.content_disposition)
+ else if (opt.content_disposition || file_exists_p (hstat.local_file))
send_head_first = true;
}
- xfree (file_name);
-
/* THE loop */
do
{
--
2.4.3