Commit 49f9f008 authored by Stefan Fritsch's avatar Stefan Fritsch
Browse files

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
parent f44eb53c
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -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;