From: Stefan Fritsch Date: Tue, 14 Feb 2012 21:18:22 +0000 (+0000) Subject: Make sure the getsfunc_*() functions used by ap_scan_script_header_err*() X-Git-Tag: 2.5.0-alpha~7462 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e9ac8ddb83db385920aeb1178d701e02ee869296;p=thirdparty%2Fapache%2Fhttpd.git Make sure the getsfunc_*() functions used by ap_scan_script_header_err*() NUL-terminate the resulting string, even in case of an error. mod_cgi and mod_cgid try to log incomplete output from CGI scripts. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1244211 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/server/util_script.c b/server/util_script.c index 3f7d847a7de..18c4aea4ca4 100644 --- a/server/util_script.c +++ b/server/util_script.c @@ -682,6 +682,7 @@ static int getsfunc_BRIGADE(char *buf, int len, void *arg) rv = apr_bucket_read(e, &bucket_data, &bucket_data_len, APR_BLOCK_READ); if (rv != APR_SUCCESS || (bucket_data_len == 0)) { + *dst = '\0'; return APR_STATUS_IS_TIMEUP(rv) ? -1 : 0; } src = bucket_data; @@ -738,8 +739,10 @@ static int getsfunc_STRING(char *w, int len, void *pvastrs) const char *p; int t; - if (!strs->curpos || !*strs->curpos) + if (!strs->curpos || !*strs->curpos) { + w[0] = '\0'; return 0; + } p = ap_strchr_c(strs->curpos, '\n'); if (p) ++p;