1
0
mirror of https://github.com/php/php-src.git synced 2026-04-25 08:58:28 +02:00

Fix undefined behaviour in strnatcmp

This commit is contained in:
Andrea Faulds
2014-12-13 22:06:27 +00:00
parent 97df260b27
commit 034e6decb3
+2 -2
View File
@@ -117,11 +117,11 @@ PHPAPI int strnatcmp_ex(char const *a, size_t a_len, char const *b, size_t b_len
ca = *ap; cb = *bp;
/* skip over leading zeros */
while (leading && ca == '0' && (ap+1 < aend) && isdigit(*(ap+1))) {
while (leading && ca == '0' && (ap+1 < aend) && isdigit((int)(unsigned char)*(ap+1))) {
ca = *++ap;
}
while (leading && cb == '0' && (bp+1 < bend) && isdigit(*(bp+1))) {
while (leading && cb == '0' && (bp+1 < bend) && isdigit((int)(unsigned char)*(bp+1))) {
cb = *++bp;
}