1
0
mirror of https://github.com/apache/httpd.git synced 2025-08-07 04:02:58 +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:
Jim Jagielski
2013-10-18 13:10:45 +00:00
parent 7fa552c097
commit d897f098f9

View File

@@ -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;
}