stdlib: fix SDL_strtol of "0" with base 0

SDL_strtol("0") skipped the "0" octal prefix
and returned a failure because the remainder of the string was empty.
This commit is contained in:
Anonymous Maarten
2024-12-30 23:23:36 +01:00
committed by Anonymous Maarten
parent 54752f8d1c
commit b713e7581b
2 changed files with 12 additions and 1 deletions

View File

@@ -368,7 +368,7 @@ static size_t SDL_ScanUnsignedLongLongInternal(const char *text, int count, int
negative = *text == '-';
++text;
}
if ((radix == 0 || radix == 16) && *text == '0') {
if ((radix == 0 || radix == 16) && *text == '0' && text[1] != '\0') {
++text;
if (*text == 'x' || *text == 'X') {
radix = 16;