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 committed 2000-08-08 09:06:51 +00:00
1 parent e31a7fcdfc
commit 8bf2339870
1 file changed
+2 -1
+2 -1
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];