mqtt: fix EOF handling

In mqtt_recv_atleast(), recognize an EOF as error.

Fixes #20815
Reported-by: Max Dymond
Closes #20830
This commit is contained in:
Stefan Eissing 2026-03-06 08:38:03 +01:00 committed by Daniel Stenberg
parent 5f13a7645e
commit 704e7a85f3
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2

View file

@ -379,6 +379,8 @@ static CURLcode mqtt_recv_atleast(struct Curl_easy *data, size_t nbytes)
result = Curl_xfer_recv(data, (char *)readbuf, nbytes - rlen, &nread);
if(result)
return result;
if(!nread) /* EOF */
return CURLE_RECV_ERROR;
if(curlx_dyn_addn(&mq->recvbuf, readbuf, nread))
return CURLE_OUT_OF_MEMORY;
rlen = curlx_dyn_len(&mq->recvbuf);