#34 Fix for StringUtil::vform() crash

closed-fixed
None
5
2009-05-12
2008-08-30
Josh Taylor
No

StringUtil::vform() formats a variable argument vector into a std::string. It tries to use vsnprintf into a 1024 character buffer. If that fails because the buffer is too small, it grows the buffer and tries again. However, it was reusing the same va_list argument pointer, which points off the end of the argument list after the first go-around with vsnprintf. The second try usually crashes, or at least results in something unexpected. Fixed this by saving the va_list state using va_copy(). This is a C99 macro, so older systems might have a problem with this fix.

Discussion

  • darkangel

    darkangel - 2009-05-12
    • assigned_to: nobody --> dark--angel
    • status: open --> closed-fixed
     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.





No, thanks