The attached patch reverts 987a4a73 to prevent the following segfault:

fk@r500 ~/git/curl/tests $./runtests.pl -a -n -g 76
********* System characteristics ******** 
* curl 7.38.1-DEV (amd64-unknown-freebsd11.0) 
* libcurl/7.38.1-DEV OpenSSL/1.0.1i zlib/1.2.8 libidn/1.29
* Features: Debug TrackMemory IDN IPv6 Largefile NTLM NTLM_WB SSL libz TLS-SRP 
* Host: r500.local
* System: FreeBSD r500.local 11.0-CURRENT FreeBSD 11.0-CURRENT #662 
r272562+f030433(fk): Sun Oct  5 17:23:32 CEST 2014     
[email protected]:/usr/obj/usr/src/sys/ZOEY  amd64
* Server SSL:        ON   libcurl SSL:  ON 
* debug build:       ON   track memory: ON 
* valgrind:          OFF  HTTP IPv6     ON 
* FTP IPv6           ON   Libtool lib:  ON 
* Shared build:      yes  Resolver:     stock
* SSL library:       OpenSSL
* Ports:
*   HTTP/8990 FTP/8992 FTP2/8995 RTSP/9007 FTPS/8993 HTTPS/8991 
*   TFTP/8997 HTTP-IPv6/8994 RTSP-IPv6/9008 FTP-IPv6/8996 
*   GOPHER/9009 GOPHER-IPv6/9009
*   SSH/8999 SOCKS/9000 POP3/9001 IMAP/9003 SMTP/9005
*   POP3-IPv6/9002 IMAP-IPv6/9004 SMTP-IPv6/9006
*   HTTPTLS/9011 HTTPTLS-IPv6/9012 
*   HTTP-PIPE/9014 
***************************************** 
test 0076...[HTTP, -O with no file name part in the URL]
GNU gdb 6.1.1 [FreeBSD]
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "amd64-marcel-freebsd"...
Argument list to give program being debugged when it is started is "--include 
--trace-ascii log/trace76 --trace-time http://127.0.0.1:8990/76/ -O".
(gdb) r
Starting program: /home/fk/git/curl/src/.libs/curl --include --trace-ascii 
log/trace76 --trace-time http://127.0.0.1:8990/76/ -O

Program received signal SIGSEGV, Segmentation fault.
0x000000000040ff52 in operate_do (global=0x7fffffffe688, config=0x802006408) at 
tool_operate.c:546
546                 if(!*outfile && !config->content_disposition) {
Current language:  auto; currently minimal
(gdb) where
#0  0x000000000040ff52 in operate_do (global=0x7fffffffe688, 
config=0x802006408) at tool_operate.c:546
#1  0x000000000040f058 in operate (config=0x7fffffffe688, argc=7, 
argv=0x7fffffffe768) at tool_operate.c:1842
#2  0x000000000040df08 in main (argc=7, argv=0x7fffffffe768) at tool_main.c:252
(gdb) p outfile
$1 = 0x0

This also seems to affect some of the auto builders:
http://curl.haxx.se/dev/log.cgi?id=20141009013649-10942#prob5

Fabian
From 9151b61ebd37e4ea0740a99e9455f55b41ec1553 Mon Sep 17 00:00:00 2001
From: Fabian Keil <[email protected]>
Date: Thu, 9 Oct 2014 16:10:55 +0200
Subject: [PATCH] Revert "operate_do: skip superfluous check for NULL pointer"

Apparently the check isn't superfluous after all.
Gets test76 working again on FreeBSD.

This reverts commit 987a4a7367ac8df32628ba738342e2206582f1e7.
---
 src/tool_operate.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/tool_operate.c b/src/tool_operate.c
index fe54a34..6093a11 100644
--- a/src/tool_operate.c
+++ b/src/tool_operate.c
@@ -543,7 +543,7 @@ static CURLcode operate_do(struct GlobalConfig *global,
             res = get_url_file_name(&outfile, this_url);
             if(res)
               goto show_error;
-            if(!*outfile && !config->content_disposition) {
+            if((!outfile || !*outfile) && !config->content_disposition) {
               helpf(global->errors, "Remote file name has no length!\n");
               res = CURLE_WRITE_ERROR;
               goto quit_urls;
-- 
1.9.0

Attachment: signature.asc
Description: PGP signature

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html

Reply via email to