Skip to content

Commit

Permalink
Fixed bug 2596 - SDL_SetError fails on on NULL on systems with vsnprintf
Browse files Browse the repository at this point in the history
sfalexrog

On systems with vsnprintf call SDL_SetError fails when passed a NULL as an argument. SDL's implementation checks for NULL (as seen in the commit: https://hg.libsdl.org/SDL/rev/835403a6aec8), but system implementation may crash.
  • Loading branch information
slouken committed Jun 21, 2014
1 parent 6c0a7b9 commit 0d67384
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/stdlib/SDL_string.c
Expand Up @@ -1276,6 +1276,9 @@ SDL_snprintf(SDL_OUT_Z_CAP(maxlen) char *text, size_t maxlen, SDL_PRINTF_FORMAT_
#ifdef HAVE_VSNPRINTF
int SDL_vsnprintf(SDL_OUT_Z_CAP(maxlen) char *text, size_t maxlen, const char *fmt, va_list ap)
{
if (!fmt) {
fmt = "";
}
return vsnprintf(text, maxlen, fmt, ap);
}
#else
Expand Down

0 comments on commit 0d67384

Please sign in to comment.