]> granicus.if.org Git - php/commitdiff
Fixed a signed / unsigned issue.
authorMoriyoshi Koizumi <moriyoshi@php.net>
Mon, 24 Feb 2003 16:29:00 +0000 (16:29 +0000)
committerMoriyoshi Koizumi <moriyoshi@php.net>
Mon, 24 Feb 2003 16:29:00 +0000 (16:29 +0000)
# imagine the case like "\\\xfe" where walk[1] takes a value that is greater
# than 127 in integer...

ext/ereg/ereg.c
ext/standard/reg.c

index d641cf9cfd25b9aa8f6f4e34828f361017dfb170..1eb83f0187dedda9800093e00b58f9868541f1ea 100644 (file)
@@ -324,7 +324,7 @@ PHPAPI char *php_reg_replace(const char *pattern, const char *replace, const cha
                        new_l = strlen(buf) + subs[0].rm_so; /* part before the match */
                        walk = replace;
                        while (*walk) {
-                               if ('\\' == *walk && isdigit(walk[1]) && walk[1] - '0' <= ((char) re.re_nsub)) {
+                               if ('\\' == *walk && isdigit(walk[1]) && ((unsigned char)walk[1]) - '0' <= re.re_nsub) {
                                        if (subs[walk[1] - '0'].rm_so > -1 && subs[walk[1] - '0'].rm_eo > -1) {
                                                new_l += subs[walk[1] - '0'].rm_eo - subs[walk[1] - '0'].rm_so;
                                        }    
index d641cf9cfd25b9aa8f6f4e34828f361017dfb170..1eb83f0187dedda9800093e00b58f9868541f1ea 100644 (file)
@@ -324,7 +324,7 @@ PHPAPI char *php_reg_replace(const char *pattern, const char *replace, const cha
                        new_l = strlen(buf) + subs[0].rm_so; /* part before the match */
                        walk = replace;
                        while (*walk) {
-                               if ('\\' == *walk && isdigit(walk[1]) && walk[1] - '0' <= ((char) re.re_nsub)) {
+                               if ('\\' == *walk && isdigit(walk[1]) && ((unsigned char)walk[1]) - '0' <= re.re_nsub) {
                                        if (subs[walk[1] - '0'].rm_so > -1 && subs[walk[1] - '0'].rm_eo > -1) {
                                                new_l += subs[walk[1] - '0'].rm_eo - subs[walk[1] - '0'].rm_so;
                                        }