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-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=da071e65b6b7be22fcd7b7d245087869c1c0d87a;p=thirdparty%2Fapache%2Fhttpd.git 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 bbd77490ae9..405c41e58ae 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