]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
cookie: return error on OOM
authorDaniel Stenberg <daniel@haxx.se>
Tue, 18 Nov 2025 14:00:50 +0000 (15:00 +0100)
committerDaniel Stenberg <daniel@haxx.se>
Tue, 18 Nov 2025 14:57:05 +0000 (15:57 +0100)
Follow-up to 3f0629ca443825916cbc0795bcd5f241fbf710
Closes #19591

lib/cookie.c

index c7dedc95e849b747567507e2181b16dbba069cc1..85356d563bb1afd67b9030e91c0d0851521b3eef 100644 (file)
@@ -464,10 +464,11 @@ parse_cookie_header(struct Curl_easy *data,
           return CURLE_OK;
 
         strstore(&co->name, curlx_str(&name), curlx_strlen(&name));
-        strstore(&co->value, curlx_str(&val), curlx_strlen(&val));
-        done = TRUE;
+        if(co->name)
+          strstore(&co->value, curlx_str(&val), curlx_strlen(&val));
         if(!co->name || !co->value)
-          return CURLE_OK;
+          return CURLE_OUT_OF_MEMORY;
+        done = TRUE;
 
         if(invalid_octets(co->value) || invalid_octets(co->name)) {
           infof(data, "invalid octets in name/value, cookie dropped");