Skip to content
This repository has been archived by the owner on Feb 11, 2021. It is now read-only.

Commit

Permalink
Fixed bug in SDL_strcasecmp() with strings of different sizes
Browse files Browse the repository at this point in the history
  • Loading branch information
slouken committed Dec 23, 2012
1 parent c9c81c5 commit 27d704d
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/stdlib/SDL_string.c
Expand Up @@ -858,9 +858,13 @@ SDL_strncasecmp(const char *str1, const char *str2, size_t maxlen)
++str2;
--maxlen;
}
a = SDL_tolower((unsigned char) *str1);
b = SDL_tolower((unsigned char) *str2);
return (int) ((unsigned char) a - (unsigned char) b);
if (maxlen == 0) {
return 0;
} else {
a = SDL_tolower((unsigned char) *str1);
b = SDL_tolower((unsigned char) *str2);
return (int) ((unsigned char) a - (unsigned char) b);
}
}
#endif

Expand Down

0 comments on commit 27d704d

Please sign in to comment.