This is the mail archive of the glibc-bugs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug libc/13303] strange crash in 64bit vsnprintf()


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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]