From a81a56ebbef14c9afa6ede671a440c2737de40bb Mon Sep 17 00:00:00 2001 From: Ben Fuhrmannek Date: Wed, 12 Oct 2016 14:34:35 +0200 Subject: wording --- ufilter.c | 78 +++++++++++++++++++++++++++++++-------------------------------- 1 file changed, 39 insertions(+), 39 deletions(-) diff --git a/ufilter.c b/ufilter.c index cb36a67..b7543ea 100644 --- a/ufilter.c +++ b/ufilter.c @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ /* - $Id: ufilter.c,v 1.1.1.1 2007-11-28 01:15:35 sesser Exp $ + $Id: ufilter.c,v 1.1.1.1 2007-11-28 01:15:35 sesser Exp $ */ #ifdef HAVE_CONFIG_H @@ -36,7 +36,7 @@ // #if !HAVE_RFC1867_CALLBACK // PHP_SUHOSIN_API int (*php_rfc1867_callback)(unsigned int event, void *event_data, void **extra) = NULL; // #endif -// +// /* {{{ SAPI_UPLOAD_VARNAME_FILTER_FUNC */ @@ -49,12 +49,12 @@ static int check_fileupload_varname(char *varname) /* Normalize the variable name */ suhosin_normalize_varname(var); - + /* Find length of variable name */ index = strchr(var, '['); total_len = strlen(var); var_len = index ? index-var : total_len; - + /* Drop this variable if it exceeds the varname/total length limit */ if (SUHOSIN7_G(max_varname_length) && SUHOSIN7_G(max_varname_length) < var_len) { suhosin_log(S_FILES, "configured request variable name length limit exceeded - dropped variable '%s'", var); @@ -80,38 +80,38 @@ static int check_fileupload_varname(char *varname) goto return_failure; } } - + /* Find out array depth */ while (index) { char *index_end; unsigned int index_length; - + /* overjump '[' */ index++; - + /* increase array depth */ depth++; - + index_end = strchr(index, ']'); if (index_end == NULL) { index_end = index+strlen(index); } - + index_length = index_end - index; - + if (SUHOSIN7_G(max_array_index_length) && SUHOSIN7_G(max_array_index_length) < index_length) { suhosin_log(S_FILES, "configured request variable array index length limit exceeded - dropped variable '%s'", var); if (!SUHOSIN7_G(simulation)) { goto return_failure; } - } + } if (SUHOSIN7_G(max_post_array_index_length) && SUHOSIN7_G(max_post_array_index_length) < index_length) { suhosin_log(S_FILES, "configured POST variable array index length limit exceeded - dropped variable '%s'", var); if (!SUHOSIN7_G(simulation)) { goto return_failure; } - } - + } + /* index whitelist/blacklist */ if (SUHOSIN7_G(array_index_whitelist) && *(SUHOSIN7_G(array_index_whitelist))) { if (suhosin_strnspn(index, index_length, SUHOSIN7_G(array_index_whitelist)) != index_length) { @@ -128,11 +128,11 @@ static int check_fileupload_varname(char *varname) } } } - - - index = strchr(index, '['); + + + index = strchr(index, '['); } - + /* Drop this variable if it exceeds the array depth limit */ if (SUHOSIN7_G(max_array_depth) && SUHOSIN7_G(max_array_depth) < depth) { suhosin_log(S_FILES, "configured request variable array depth limit exceeded - dropped variable '%s'", var); @@ -146,8 +146,8 @@ static int check_fileupload_varname(char *varname) goto return_failure; } } - - + + /* Drop this variable if it is one of GLOBALS, _GET, _POST, ... */ /* This is to protect several silly scripts that do globalizing themself */ if (suhosin_is_protected_varname(var, var_len)) { @@ -159,10 +159,10 @@ static int check_fileupload_varname(char *varname) efree(var); return SUCCESS; - + return_failure: efree(var); - return FAILURE; + return FAILURE; } /* }}} */ @@ -203,13 +203,13 @@ int suhosin_rfc1867_filter(unsigned int event, void *event_data, void **extra) switch (event) { case MULTIPART_EVENT_START: case MULTIPART_EVENT_FORMDATA: - /* nothing todo */ + /* nothing to do */ break; case MULTIPART_EVENT_FILE_START: { multipart_event_file_start *mefs = (multipart_event_file_start *) event_data; - + /* Drop if no more variables flag is set */ if (SUHOSIN7_G(no_more_uploads)) { goto continue_with_failure; @@ -247,7 +247,7 @@ int suhosin_rfc1867_filter(unsigned int event, void *event_data, void **extra) } if (SUHOSIN7_G(upload_disallow_binary)) { - + multipart_event_file_data *mefd = (multipart_event_file_data *) event_data; char *cp, *cpend; @@ -275,11 +275,11 @@ int suhosin_rfc1867_filter(unsigned int event, void *event_data, void **extra) } if (SUHOSIN7_G(upload_remove_binary)) { - + multipart_event_file_data *mefd = (multipart_event_file_data *) event_data; size_t i, j; int n; - + for (i=0, j=0; ilength; i++) { if (mefd->data[i] >= 32 || isspace(mefd->data[i])) { mefd->data[j++] = mefd->data[i]; @@ -296,7 +296,7 @@ int suhosin_rfc1867_filter(unsigned int event, void *event_data, void **extra) #endif } mefd->data[j] = '\0'; - + SDEBUG("removing binary %zu %zu",i,j); /* IMPORTANT FOR DAISY CHAINING */ mefd->length = j; @@ -304,11 +304,11 @@ int suhosin_rfc1867_filter(unsigned int event, void *event_data, void **extra) *mefd->newlength = j; } } - + break; case MULTIPART_EVENT_FILE_END: - + if (SUHOSIN7_G(upload_verification_script)) { multipart_event_file_end *mefe = (multipart_event_file_end *) event_data; char cmd[8192]; @@ -316,19 +316,19 @@ int suhosin_rfc1867_filter(unsigned int event, void *event_data, void **extra) int first=1; struct stat st; char *sname = SUHOSIN7_G(upload_verification_script); - + /* ignore files that will get deleted anyway */ if (mefe->cancel_upload) { break; } - + /* ignore empty scriptnames */ while (isspace(*sname)) ++sname; if (*sname == 0) { SUHOSIN7_G(num_uploads)++; break; } - + if (VCWD_STAT(sname, &st) < 0) { suhosin_log(S_FILES, "unable to find fileupload verification script %s - file dropped", sname); if (!SUHOSIN7_G(simulation)) { @@ -345,7 +345,7 @@ int suhosin_rfc1867_filter(unsigned int event, void *event_data, void **extra) goto continue_with_next; } } - + ap_php_snprintf(cmd, sizeof(cmd), "%s %s 2>&1", sname, mefe->temp_filename); if ((in = VCWD_POPEN(cmd, "r")) == NULL) { @@ -356,9 +356,9 @@ int suhosin_rfc1867_filter(unsigned int event, void *event_data, void **extra) goto continue_with_next; } } - + retval = FAILURE; - + /* read and forget the result */ while (1) { int readbytes = fread(cmd, 1, sizeof(cmd), in); @@ -394,14 +394,14 @@ int suhosin_rfc1867_filter(unsigned int event, void *event_data, void **extra) break; case MULTIPART_EVENT_END: - /* nothing todo */ + /* nothing to do */ break; - + default: /* unknown: return failure */ goto continue_with_failure; } -continue_with_next: +continue_with_next: // #if HAVE_RFC1867_CALLBACK if (php_rfc1867_callback != NULL) { return php_rfc1867_callback(event, event_data, extra); @@ -409,7 +409,7 @@ continue_with_next: // #endif return SUCCESS; continue_with_failure: - SUHOSIN7_G(abort_request) = 1; + SUHOSIN7_G(abort_request) = 1; return FAILURE; } -- cgit v1.3