From 8bf23398704a96aa20ee9757430283faff3de9c2 Mon Sep 17 00:00:00 2001 From: Martin Kraemer Date: Tue, 8 Aug 2000 09:06:51 +0000 Subject: [PATCH] Bug #6016: Fix EBCDIC logic error in urlencode() (a strchr() test was used backwards) Reported by: dumbunny@tivo.com --- ext/standard/url.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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]; -- 2.50.1