From b8cd29330dcecd160a91bb5521893ae4253700d0 Mon Sep 17 00:00:00 2001 From: Moriyoshi Koizumi Date: Wed, 3 Dec 2003 20:59:12 +0000 Subject: [PATCH] MFH(r-1.71): Possible fix for bug #26391 (parse_url() destroys strings that contain a character in range of 0x80-0xff) # I couldn't reproduce it with Panther though. --- ext/standard/url.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/ext/standard/url.c b/ext/standard/url.c index 24967ce127..d66bd546d1 100644 --- a/ext/standard/url.c +++ b/ext/standard/url.c @@ -104,7 +104,7 @@ PHPAPI php_url *php_url_parse(char *str) * correctly parse things like a.com:80 */ p = e + 1; - while (isdigit(*p)) { + while (isdigit((int)*(unsigned char *)p)) { p++; } @@ -145,7 +145,7 @@ PHPAPI php_url *php_url_parse(char *str) p = e + 1; pp = p; - while (pp-p < 6 && isdigit(*pp)) { + while (pp-p < 6 && isdigit((int)*(unsigned char *)pp)) { pp++; } @@ -330,12 +330,12 @@ static int php_htoi(char *s) int value; int c; - c = s[0]; + c = ((unsigned char *)s)[0]; if (isupper(c)) c = tolower(c); value = (c >= '0' && c <= '9' ? c - '0' : c - 'a' + 10) * 16; - c = s[1]; + c = ((unsigned char *)s)[1]; if (isupper(c)) c = tolower(c); value += c >= '0' && c <= '9' ? c - '0' : c - 'a' + 10; @@ -443,7 +443,7 @@ PHPAPI int php_url_decode(char *str, int len) while (len--) { if (*data == '+') *dest = ' '; - else if (*data == '%' && len >= 2 && isxdigit((int) *(data + 1)) && isxdigit((int) *(data + 2))) { + else if (*data == '%' && len >= 2 && isxdigit((int) *(unsigned char *)(data + 1)) && isxdigit((int) *(unsigned char *)(data + 2))) { #ifndef CHARSET_EBCDIC *dest = (char) php_htoi(data + 1); #else -- 2.50.1