From: Jim Jagielski Date: Fri, 18 Oct 2013 13:10:45 +0000 (+0000) Subject: RĂ¼diger and Yann suggestions X-Git-Tag: 2.5.0-alpha~4915 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=d897f098f976845750fe455449e34cfa88df70df;p=apache RĂ¼diger and Yann suggestions git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1533440 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/modules/proxy/proxy_util.c b/modules/proxy/proxy_util.c index 5d634ed520..c283994f25 100644 --- a/modules/proxy/proxy_util.c +++ b/modules/proxy/proxy_util.c @@ -93,19 +93,20 @@ 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) { + /* special case handling */ + if (!dlen) { + /* XXX: APR_ENOSPACE would be better */ + return APR_EGENERAL; + } + if (!src) { *dst = '\0'; return APR_SUCCESS; } thenil = apr_cpystrn(dst, src, dlen); thelen = thenil - dst; - /* Assume the typical case is smaller copying into bigger - so we have a fast return */ - if ((thelen < dlen-1) || (src[thelen] == '\0')) { + if (src[thelen] == '\0') { return APR_SUCCESS; } - /* XXX: APR_ENOSPACE would be better */ return APR_EGENERAL; }