tool_cb_hdr: fix fwrite check in header callback

Compare fwrite result to nmemb (items), not cb (bytes).

Closes #18593
This commit is contained in:
Joshua Rogers 2025-09-18 06:45:12 +05:00 committed by Daniel Stenberg
parent a827e4294c
commit 20f757ef14
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2

View 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)) {