]> granicus.if.org Git - apache/commitdiff
ap_proxy_strncpy should correctly handle src being NULL.
authorJim Jagielski <jim@apache.org>
Thu, 17 Oct 2013 15:02:04 +0000 (15:02 +0000)
committerJim Jagielski <jim@apache.org>
Thu, 17 Oct 2013 15:02:04 +0000 (15:02 +0000)
Actually, apr_cpystrn() should as well...

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1533100 13f79535-47bb-0310-9956-ffa450edef68

modules/proxy/proxy_util.c

index bbd77490ae96954d4d87f71a46585a87e9f67941..405c41e58ae6f44f787ce49768a0f9b5bdde6348 100644 (file)
@@ -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