1
0
mirror of https://github.com/php/php-src.git synced 2026-03-26 01:02:25 +01:00

Bug #6016: Fix EBCDIC logic error in urlencode()

(a strchr() test was used backwards)
Reported by: dumbunny@tivo.com
This commit is contained in:
Martin Kraemer
2000-08-08 09:06:51 +00:00
parent e31a7fcdfc
commit 8bf2339870

View File

@@ -253,7 +253,8 @@ char *php_url_encode(char *s, int len)
str[y] = hexchars[(unsigned char) s[x] & 15];
}
#else /*CHARSET_EBCDIC*/
} else if (!isalnum(str[y]) && strchr("_-.", str[y]) != NULL) {
} else if (!isalnum(str[y]) && strchr("_-.", str[y]) == NULL) {
/* Allow only alphanumeric chars and '_', '-', '.'; escape the rest */
str[y++] = '%';
str[y++] = hexchars[os_toascii[(unsigned char) s[x]] >> 4];
str[y] = hexchars[os_toascii[(unsigned char) s[x]] & 0x0F];