Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix phalcon_escape_multi() to generate valid UTF-8 #1802

Merged
merged 2 commits into from Jan 13, 2014
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Fix #1681
(cherry picked from commit 683b399)
  • Loading branch information
sjinks committed Jan 13, 2014
commit 9aaaabc598aa6eccb5dbaedb1ef7de5d252537d7
6 changes: 4 additions & 2 deletions ext/kernel/filter.c
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ static long phalcon_unpack(char *data, int size, int issigned, int *map)
static inline char *phalcon_longtohex(unsigned long value) {

static char digits[] = "0123456789abcdef";
char buf[(sizeof(unsigned long) << 3) + 1];
char buf[(sizeof(unsigned long) << 1) + 1];
char *ptr, *end;

end = ptr = buf + sizeof(buf) - 1;
Expand Down Expand Up @@ -248,7 +248,7 @@ void phalcon_escape_multi(zval *return_value, zval *param, const char *escape_ch
/**
* Alphanumeric characters are not escaped
*/
if (value < 256 && isalnum(value)) {
if (value > 32 && value < 127 && isalnum(value)) {
smart_str_appendc(&escaped_str, (unsigned char) value);
continue;
}
Expand Down Expand Up @@ -283,6 +283,8 @@ void phalcon_escape_multi(zval *return_value, zval *param, const char *escape_ch
case ';':
case '_':
case '|':
case '~':
case '`':
smart_str_appendc(&escaped_str, (unsigned char) value);
continue;
}
Expand Down