diff options
author | Andrea Faulds <ajf@ajf.me> | 2014-12-13 22:06:27 +0000 |
---|---|---|
committer | Andrea Faulds <ajf@ajf.me> | 2014-12-13 22:06:27 +0000 |
commit | 2cca4d01935ffd5bd2ec6aad9eeccf6aee269933 (patch) | |
tree | 21eb4d646806a8f075bc743d4946c99edac283bb | |
parent | 8c99b65c4d2bc91aff7efce6f88713ebcb5d55c5 (diff) | |
download | php-git-2cca4d01935ffd5bd2ec6aad9eeccf6aee269933.tar.gz |
Fix undefined behaviour in strnatcmp
-rw-r--r-- | ext/standard/strnatcmp.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/ext/standard/strnatcmp.c b/ext/standard/strnatcmp.c index de6f727343..0decda3df9 100644 --- a/ext/standard/strnatcmp.c +++ b/ext/standard/strnatcmp.c @@ -118,11 +118,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; } |