summaryrefslogtreecommitdiff
path: root/ext/standard/url.c
diff options
context:
space:
mode:
authorMoriyoshi Koizumi <moriyoshi@php.net>2003-12-03 20:58:12 (GMT)
committerMoriyoshi Koizumi <moriyoshi@php.net>2003-12-03 20:58:12 (GMT)
commit247f9914436bc994990fdc361ead1081e112a0fe (patch)
treeacf374d05665055f5de7807faa62cc4053893093 /ext/standard/url.c
parent110044b5f1519591e53855c29f095da9575192b2 (diff)
downloadphp-247f9914436bc994990fdc361ead1081e112a0fe.tar.gz
Possible fix for bug #26391 (parse_url() destroys strings that contain
a character in range of \x80-\xff))
Diffstat (limited to 'ext/standard/url.c')
-rw-r--r--ext/standard/url.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/ext/standard/url.c b/ext/standard/url.c
index 419b814..1ae3e7e 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++;
}
@@ -151,7 +151,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++;
}
@@ -336,12 +336,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;
@@ -457,7 +457,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
@@ -605,7 +605,7 @@ no_name_header:
c = *p;
*p = '\0';
s = p + 1;
- while (isspace(*s)) {
+ while (isspace((int)*(unsigned char *)s)) {
s++;
}