← Commit list

9e2c582d6c

Stefan Eissing
Stefan Eissing
2025-10-09
SUCCESS Duration: 183s

Subject

memdup0: handle edge case

Binary

No binary (build failed)

Architecture & Compiler Flags

Architecture: x86_64-linux-gnu Compiler: gcc (Ubuntu 11.4.0-1ubuntu1~22.04.3) 11.4.0

—

Build Log

(log yok)

Commit Diff GitHub →

lib/strdup.c+1 -1
@@ -111,7 +111,7 @@ void *Curl_memdup(const void *src, size_t length)
***************************************************************************/
void *Curl_memdup0(const char *src, size_t length)
{
- char *buf = malloc(length + 1);
+ char *buf = (length < SIZE_MAX) ? malloc(length + 1) : NULL;
if(!buf)
return NULL;
if(length) {