mirror of
https://github.com/apache/httpd.git
synced 2025-08-08 15:02:10 +03:00
Rüdiger and Yann suggestions
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1533440 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
@@ -93,19 +93,20 @@ PROXY_DECLARE(apr_status_t) ap_proxy_strncpy(char *dst, const char *src,
|
|||||||
char *thenil;
|
char *thenil;
|
||||||
apr_size_t thelen;
|
apr_size_t thelen;
|
||||||
|
|
||||||
/* special case: really apr_cpystrn should handle src==NULL*/
|
/* special case handling */
|
||||||
if (!src && dlen) {
|
if (!dlen) {
|
||||||
|
/* XXX: APR_ENOSPACE would be better */
|
||||||
|
return APR_EGENERAL;
|
||||||
|
}
|
||||||
|
if (!src) {
|
||||||
*dst = '\0';
|
*dst = '\0';
|
||||||
return APR_SUCCESS;
|
return APR_SUCCESS;
|
||||||
}
|
}
|
||||||
thenil = apr_cpystrn(dst, src, dlen);
|
thenil = apr_cpystrn(dst, src, dlen);
|
||||||
thelen = thenil - dst;
|
thelen = thenil - dst;
|
||||||
/* Assume the typical case is smaller copying into bigger
|
if (src[thelen] == '\0') {
|
||||||
so we have a fast return */
|
|
||||||
if ((thelen < dlen-1) || (src[thelen] == '\0')) {
|
|
||||||
return APR_SUCCESS;
|
return APR_SUCCESS;
|
||||||
}
|
}
|
||||||
/* XXX: APR_ENOSPACE would be better */
|
|
||||||
return APR_EGENERAL;
|
return APR_EGENERAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user