From: Jim Jagielski Date: Thu, 17 Oct 2013 15:02:04 +0000 (+0000) Subject: ap_proxy_strncpy should correctly handle src being NULL. X-Git-Tag: 2.5.0-alpha~4929 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=81e827c11c275be63a81780b23b3e1e1c0ca3a5f;p=apache ap_proxy_strncpy should correctly handle src being NULL. Actually, apr_cpystrn() should as well... git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1533100 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/modules/proxy/proxy_util.c b/modules/proxy/proxy_util.c index bbd77490ae..405c41e58a 100644 --- a/modules/proxy/proxy_util.c +++ b/modules/proxy/proxy_util.c @@ -93,6 +93,11 @@ PROXY_DECLARE(apr_status_t) ap_proxy_strncpy(char *dst, const char *src, char *thenil; apr_size_t thelen; + /* special case: really apr_cpystrn should handle src==NULL*/ + if (!src && dlen) { + *dst = '\0'; + return APR_SUCCESS; + } thenil = apr_cpystrn(dst, src, dlen); thelen = thenil - dst; /* Assume the typical case is smaller copying into bigger