X-Git-Url: http://www.privoxy.org/gitweb/?a=blobdiff_plain;f=cgisimple.c;h=e4e01e77ee035a86fc6dd4135c4d82c6cc1b3ebe;hb=e38b2f01939563647641736155d8355571246ff9;hp=514d2453086653095c5cd8ec683640e11277a402;hpb=e11bc95711b7da314179cb6ae3e37a0dd9e64738;p=privoxy.git diff --git a/cgisimple.c b/cgisimple.c index 514d2453..e4e01e77 100644 --- a/cgisimple.c +++ b/cgisimple.c @@ -1,4 +1,4 @@ -const char cgisimple_rcs[] = "$Id: cgisimple.c,v 1.128 2014/06/03 10:29:23 fabiankeil Exp $"; +const char cgisimple_rcs[] = "$Id: cgisimple.c,v 1.133 2016/02/26 12:29:38 fabiankeil Exp $"; /********************************************************************* * * File : $Source: /cvsroot/ijbswa/current/cgisimple.c,v $ @@ -178,7 +178,7 @@ jb_err cgi_die (struct client_state *csp, "\n" " Privoxy shutdown request received\n" " \n" - " \n" + " \n" "\n" "\n" "

Privoxy shutdown request received

\n" @@ -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 @@ -1914,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; } @@ -1985,19 +1985,18 @@ static jb_err load_file(const char *filename, char **buffer, size_t *length) filename); } - *buffer = (char *)zalloc(*length + 1); - if (NULL == *buffer) - { - err = JB_ERR_MEMORY; - } - else if (!fread(*buffer, *length, 1, fp)) + *buffer = zalloc_or_die(*length + 1); + + 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; }