]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
cf_socket_recv: don't count reading zero bytes as first byte
authorDaniel Stenberg <daniel@haxx.se>
Fri, 19 Sep 2025 11:23:14 +0000 (13:23 +0200)
committerDaniel Stenberg <daniel@haxx.se>
Fri, 19 Sep 2025 12:39:15 +0000 (14:39 +0200)
Reported in Joshua's sarif data

Closes #18615

lib/cf-socket.c

index f449ca36caf73f81900359bdaed5d2b123ec6ef2..308325ccdc153d689ebc153be486b4a5a3ab8416 100644 (file)
@@ -1578,7 +1578,7 @@ static CURLcode cf_socket_recv(struct Curl_cfilter *cf, struct Curl_easy *data,
     *pnread = (size_t)nread;
 
   CURL_TRC_CF(data, cf, "recv(len=%zu) -> %d, %zu", len, result, *pnread);
-  if(!result && !ctx->got_first_byte) {
+  if(!result && !ctx->got_first_byte && nread) {
     ctx->first_byte_at = curlx_now();
     ctx->got_first_byte = TRUE;
   }