From d0e9a364608a9ff12d16fcaf8fb7119bc775715f Mon Sep 17 00:00:00 2001 From: Ozkan Sezer Date: Wed, 26 Sep 2018 10:38:40 +0300 Subject: [PATCH] SDL_vsnprintf: %.* and %* now parse precision and width. (bug #4263.) --- src/stdlib/SDL_string.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/stdlib/SDL_string.c b/src/stdlib/SDL_string.c index 22aceedb18106..db91a0431078c 100644 --- a/src/stdlib/SDL_string.c +++ b/src/stdlib/SDL_string.c @@ -1593,11 +1593,18 @@ SDL_vsnprintf(SDL_OUT_Z_CAP(maxlen) char *text, size_t maxlen, const char *fmt, if (*fmt >= '0' && *fmt <= '9') { info.width = SDL_strtol(fmt, (char **)&fmt, 0); } + else if (*fmt == '*') { + ++fmt; + info.width = va_arg(ap, int); + } if (*fmt == '.') { ++fmt; if (*fmt >= '0' && *fmt <= '9') { info.precision = SDL_strtol(fmt, (char **)&fmt, 0); + } else if (*fmt == '*') { + ++fmt; + info.precision = va_arg(ap, int); } else { info.precision = 0; }