summaryrefslogtreecommitdiff
path: root/libs/libcurl/src/strdup.c
diff options
context:
space:
mode:
Diffstat (limited to 'libs/libcurl/src/strdup.c')
-rw-r--r--libs/libcurl/src/strdup.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/libs/libcurl/src/strdup.c b/libs/libcurl/src/strdup.c
index f3d8ed3846..e9f8535c6d 100644
--- a/libs/libcurl/src/strdup.c
+++ b/libs/libcurl/src/strdup.c
@@ -114,7 +114,10 @@ void *Curl_memdup0(const char *src, size_t length)
char *buf = malloc(length + 1);
if(!buf)
return NULL;
- memcpy(buf, src, length);
+ if(length) {
+ DEBUGASSERT(src); /* must never be NULL */
+ memcpy(buf, src, length);
+ }
buf[length] = 0;
return buf;
}