X-Git-Url: http://www.privoxy.org/gitweb/?p=privoxy.git;a=blobdiff_plain;f=cgisimple.c;h=7d64402147727f735993440478df23cbf8cd9a9a;hp=cefa51a489fd9d672d359a51b47363f135127956;hb=d4f4e86c3ee61b1911eee63b96dd1731086d2486;hpb=da4ded04ca0d2e8f8435b96de3963f682274d56a diff --git a/cgisimple.c b/cgisimple.c index cefa51a4..7d644021 100644 --- a/cgisimple.c +++ b/cgisimple.c @@ -1,4 +1,4 @@ -const char cgisimple_rcs[] = "$Id: cgisimple.c,v 1.126 2014/05/20 11:58:36 fabiankeil Exp $"; +const char cgisimple_rcs[] = "$Id: cgisimple.c,v 1.131 2014/10/18 11:28:49 fabiankeil Exp $"; /********************************************************************* * * File : $Source: /cvsroot/ijbswa/current/cgisimple.c,v $ @@ -682,8 +682,8 @@ static const char *get_content_type(const char *filename) int i; struct content_type { - const char *extension; - const char *content_type; + const char extension[6]; + const char content_type[11]; }; static const struct content_type content_types[] = { @@ -970,7 +970,6 @@ jb_err cgi_show_status(struct client_state *csp, #ifdef FEATURE_CGI_EDIT_ACTIONS if ((csp->config->feature_flags & RUNTIME_FEATURE_CGI_EDIT_ACTIONS) - && (NULL == strstr(csp->actions_list[i]->filename, "standard.action")) && (NULL != csp->config->actions_file_short[i])) { #ifdef HAVE_ACCESS @@ -1167,6 +1166,7 @@ jb_err cgi_show_url_info(struct client_state *csp, map_block_killer(exports, "privoxy-is-toggled-off") ) { + freez(url_param); free_map(exports); return JB_ERR_MEMORY; } @@ -1913,6 +1913,7 @@ static jb_err cgi_show_file(struct client_state *csp, s = html_encode_and_free_original(s); if (NULL == s) { + free_map(exports); return JB_ERR_MEMORY; } @@ -1989,14 +1990,16 @@ static jb_err load_file(const char *filename, char **buffer, size_t *length) { err = JB_ERR_MEMORY; } - else if (!fread(*buffer, *length, 1, fp)) + else if (1 != fread(*buffer, *length, 1, fp)) { /* - * May happen if the file size changes between fseek() and - * fread(). If it does, we just log it and serve what we got. + * May theoretically happen if the file size changes between + * fseek() and fread() because it's edited in-place. Privoxy + * and common text editors don't do that, thus we just fail. */ log_error(LOG_LEVEL_ERROR, "Couldn't completely read file %s.", filename); + freez(*buffer); err = JB_ERR_FILE; }