This is the mail archive of the
glibc-bugs@sourceware.org
mailing list for the glibc project.
[Bug libc/13303] strange crash in 64bit vsnprintf()
- From: "aj at suse dot de" <sourceware-bugzilla at sourceware dot org>
- To: glibc-bugs at sources dot redhat dot com
- Date: Mon, 17 Oct 2011 07:44:33 +0000
- Subject: [Bug libc/13303] strange crash in 64bit vsnprintf()
- Auto-submitted: auto-generated
- References: <bug-13303-131@http.sourceware.org/bugzilla/>
http://sourceware.org/bugzilla/show_bug.cgi?id=13303
Andreas Jaeger <aj at suse dot de> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
CC| |aj at suse dot de
Resolution| |INVALID
--- Comment #1 from Andreas Jaeger <aj at suse dot de> 2011-10-17 07:44:33 UTC ---
Your code is buggy, vsnprintf uses the args and you need to reset it.
va_list args;
va_start( args, params );
char buffer[0x4000];
unsigned int required = vsnprintf( buffer, sizeof(buffer), params, args );
Add va_end (args);va_start(args,params); here
char *bigbuffer = (char*)malloc( required + 1 );
vsnprintf( bigbuffer, required + 1, params, args );
va_end( args );
--
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.