summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Fuhrmannek2014-09-22 19:06:56 +0200
committerBen Fuhrmannek2014-09-22 19:06:56 +0200
commit8f2433d78347b2f1542e95652fa74d38346fb6ec (patch)
treee081aea8fde851adcf4e22ffd8c001b349dc6f8d
parent3a569c100c5b5c359cda16e0ac311032450df02e (diff)
disallow_nul does not assume the input value to be nul terminated anymore
-rw-r--r--ifilter.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/ifilter.c b/ifilter.c
index dfe7c6b..48b62c7 100644
--- a/ifilter.c
+++ b/ifilter.c
@@ -34,6 +34,13 @@
34 34
35static void (*orig_register_server_variables)(zval *track_vars_array TSRMLS_DC) = NULL; 35static void (*orig_register_server_variables)(zval *track_vars_array TSRMLS_DC) = NULL;
36 36
37#if !HAVE_STRNLEN
38static size_t strnlen(const char *s, size_t maxlen) {
39 char *r = memchr(s, '\0', maxlen);
40 return r ? r-s : maxlen;
41}
42#endif
43
37 44
38/* {{{ normalize_varname 45/* {{{ normalize_varname
39 */ 46 */
@@ -590,7 +597,7 @@ unsigned int suhosin_input_filter(int arg, char *var, char **val, unsigned int v
590 597
591 /* Check if variable value is truncated by a \0 */ 598 /* Check if variable value is truncated by a \0 */
592 599
593 if (val && *val && val_len != strlen(*val)) { 600 if (val && *val && val_len != strnlen(*val, val_len)) {
594 601
595 if (SUHOSIN_G(disallow_nul)) { 602 if (SUHOSIN_G(disallow_nul)) {
596 suhosin_log(S_VARS, "ASCII-NUL chars not allowed within request variables - dropped variable '%s'", var); 603 suhosin_log(S_VARS, "ASCII-NUL chars not allowed within request variables - dropped variable '%s'", var);