summaryrefslogtreecommitdiff
path: root/ext/standard
diff options
context:
space:
mode:
authorMartin Kraemer <martin@php.net>2000-08-08 09:06:51 +0000
committerMartin Kraemer <martin@php.net>2000-08-08 09:06:51 +0000
commit8bf23398704a96aa20ee9757430283faff3de9c2 (patch)
tree84668e0c551c8632ba6e5e7e7f24bb3371e5f8e1 /ext/standard
parente31a7fcdfcdcfc1b98dea3c466ed483bbe466c1d (diff)
downloadphp-git-8bf23398704a96aa20ee9757430283faff3de9c2.tar.gz
Bug #6016: Fix EBCDIC logic error in urlencode()
(a strchr() test was used backwards) Reported by: dumbunny@tivo.com
Diffstat (limited to 'ext/standard')
-rw-r--r--ext/standard/url.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/ext/standard/url.c b/ext/standard/url.c
index d1d6496565..ab12801d30 100644
--- a/ext/standard/url.c
+++ b/ext/standard/url.c
@@ -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];