From d897f098f976845750fe455449e34cfa88df70df Mon Sep 17 00:00:00 2001 From: Jim Jagielski Date: Fri, 18 Oct 2013 13:10:45 +0000 Subject: [PATCH] =?utf8?q?R=C3=BCdiger=20and=20Yann=20suggestions?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1533440 13f79535-47bb-0310-9956-ffa450edef68 --- modules/proxy/proxy_util.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) 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; } -- 2.40.0