]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
tool_cb_hdr: fix fwrite check in header callback
authorJoshua Rogers <MegaManSec@users.noreply.github.com>
Thu, 18 Sep 2025 01:45:12 +0000 (06:45 +0500)
committerDaniel Stenberg <daniel@haxx.se>
Thu, 18 Sep 2025 06:04:47 +0000 (08:04 +0200)
Compare fwrite result to nmemb (items), not cb (bytes).

Closes #18593

src/tool_cb_hdr.c

index 6af9d1947e1ee6118edc32de5595e3f29a7406bf..3bb3c12dc806c32d5b68f93323e15d49df12ddd1 100644 (file)
@@ -116,7 +116,7 @@ size_t tool_header_cb(char *ptr, size_t size, size_t nmemb, void *userdata)
 
   if(per->config->headerfile && heads->stream) {
     size_t rc = fwrite(ptr, size, nmemb, heads->stream);
-    if(rc != cb)
+    if(rc != nmemb)
       return rc;
     /* flush the stream to send off what we got earlier */
     if(fflush(heads->stream)) {