cURL / Mailing Lists / curl-library / Single Mail

curl-library

[ curl-Bugs-1088962 ] Curl_failf() tries to reuse a va_list

From: SourceForge.net <noreply_at_sourceforge.net>
Date: Tue, 21 Dec 2004 03:31:49 -0800

Bugs item #1088962, was opened at 2004-12-21 11:31
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=100976&aid=1088962&group_id=976

Category: debug/info output
Group: crash
Status: Open
Resolution: None
Priority: 5
Submitted By: Peter Pentchev (roamer)
Assigned to: Daniel Stenberg (bagder)
Summary: Curl_failf() tries to reuse a va_list

Initial Comment:
The current implementation of Curl_failf() creates a variable arguments
list, issues a vsnprintf() off it, and then, if cURL is running in verbose
mode, tries to issue a second vsnprintf() off the same va_list.
Unfortunately, this is usually a bad idea - the stdio library does not
guarantee that the va_list will still be usable after the v*printf()
invocation, as shown e.g. in the Single Unix Specification:
http://www.opengroup.org/onlinepubs/007908799/xsh/vfprintf.html

Attached is a patch that fixes this by slightly rearranging the operation
of Curl_failf() - first writing to the larger data->state.buffer if verbose
mode is set, and then just copying the value from there to the error
buffer. If verbose mode is not set, it just prints straight into the error
buffer as before.

If the patch is somehow mangled, it is also available from the FreeBSD
Ports Collection as ports/ftp/curl/files/patch-lib::sendf.c - e.g. from
http://cvsweb.FreeBSD.org/ports/ftp/curl/files/patch-lib::sendf.c

----------------------------------------------------------------------

You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=100976&aid=1088962&group_id=976
Received on 2004-12-21