From: Martin Kraemer Date: Tue, 8 Aug 2000 09:06:51 +0000 (+0000) Subject: Bug #6016: Fix EBCDIC logic error in urlencode() X-Git-Tag: php-4.0.2RC1~191 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=8bf23398704a96aa20ee9757430283faff3de9c2;p=php Bug #6016: Fix EBCDIC logic error in urlencode() (a strchr() test was used backwards) Reported by: dumbunny@tivo.com --- 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];