diff options
author | Eric Covener <covener@apache.org> | 2016-12-21 17:19:26 +0100 |
---|---|---|
committer | Eric Covener <covener@apache.org> | 2016-12-21 17:19:26 +0100 |
commit | b9822a70a1d1b46a12084ea0eccac876c628ea84 (patch) | |
tree | 6e1da2127df62621419c58120b81ef83d0f62005 /server | |
parent | Fix strict Host: header checking on EBCDIC (diff) | |
download | apache2-b9822a70a1d1b46a12084ea0eccac876c628ea84.tar.xz apache2-b9822a70a1d1b46a12084ea0eccac876c628ea84.zip |
fix crash in util_fcgi.c
*) mod_proxy_fcgi, mod_fcgid: Fix crashes in ap_fcgi_encoded_env_len() when
modules add empty environment variables to the request. PR60275.
[<alex2grad AT gmail.com>]
Submitted By: <alex2grad AT gmail.com>]
Committed By: covener
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1775487 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'server')
-rw-r--r-- | server/util_fcgi.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/server/util_fcgi.c b/server/util_fcgi.c index a241e965f6..7fb2c8c1c2 100644 --- a/server/util_fcgi.c +++ b/server/util_fcgi.c @@ -153,7 +153,7 @@ AP_DECLARE(apr_size_t) ap_fcgi_encoded_env_len(apr_table_t *env, envlen += keylen; - vallen = strlen(elts[i].val); + vallen = elts[i].val ? strlen(elts[i].val) : 0; if (vallen >> 7 == 0) { envlen += 1; @@ -226,7 +226,7 @@ AP_DECLARE(apr_status_t) ap_fcgi_encode_env(request_rec *r, buflen -= 4; } - vallen = strlen(elts[i].val); + vallen = elts[i].val ? strlen(elts[i].val) : 0; if (vallen >> 7 == 0) { if (buflen < 1) { @@ -262,8 +262,11 @@ AP_DECLARE(apr_status_t) ap_fcgi_encode_env(request_rec *r, rv = APR_ENOSPC; /* overflow */ break; } - memcpy(itr, elts[i].val, vallen); - itr += vallen; + + if (elts[i].val) { + memcpy(itr, elts[i].val, vallen); + itr += vallen; + } if (buflen == vallen) { (*starting_elem)++; |