]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
setopt: return error if received `curl_blob->data` is NULL
authorViktor Szakats <commit@vsz.me>
Mon, 22 Jun 2026 09:34:10 +0000 (11:34 +0200)
committerViktor Szakats <commit@vsz.me>
Mon, 22 Jun 2026 10:08:35 +0000 (12:08 +0200)
To avoid dereferencing in the function if `CURL_BLOB_COPY` is set, or
outside of the function if unset.

Reported-by: netspacer.research
Closes #22129

lib/setopt.c

index df054469d4a40946c8da10f7f1641ddead6ac51a..eb9ff2e3967912abef0ec020b92832d4a44dc541 100644 (file)
@@ -108,7 +108,7 @@ CURLcode Curl_setblobopt(struct curl_blob **blobp,
 
   if(blob) {
     struct curl_blob *nblob;
-    if(!blob->len || (blob->len > CURL_MAX_INPUT_LENGTH))
+    if(!blob->data || !blob->len || (blob->len > CURL_MAX_INPUT_LENGTH))
       return CURLE_BAD_FUNCTION_ARGUMENT;
     nblob = (struct curl_blob *)
       curlx_malloc(sizeof(struct curl_blob) +