moriyoshi Wed Dec 3 15:58:13 2003 EDT
Modified files:
/php-src/ext/standard url.c
Log:
Possible fix for bug #26391 (parse_url() destroys strings that contain
a character in range of \x80-\xff))
Index: php-src/ext/standard/url.c
diff -u php-src/ext/standard/url.c:1.70 php-src/ext/standard/url.c:1.71
--- php-src/ext/standard/url.c:1.70 Sun Oct 19 16:00:51 2003
+++ php-src/ext/standard/url.c Wed Dec 3 15:58:12 2003
@@ -15,7 +15,7 @@
| Author: Jim Winstead <[EMAIL PROTECTED]> |
+----------------------------------------------------------------------+
*/
-/* $Id: url.c,v 1.70 2003/10/19 20:00:51 shane Exp $ */
+/* $Id: url.c,v 1.71 2003/12/03 20:58:12 moriyoshi Exp $ */
#include <stdlib.h>
#include <string.h>
@@ -104,7 +104,7 @@
* correctly parse things like a.com:80
*/
p = e + 1;
- while (isdigit(*p)) {
+ while (isdigit((int)*(unsigned char *)p)) {
p++;
}
@@ -151,7 +151,7 @@
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 @@
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 @@
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 @@
c = *p;
*p = '\0';
s = p + 1;
- while (isspace(*s)) {
+ while (isspace((int)*(unsigned char *)s)) {
s++;
}
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php