mirror of
https://github.com/curl/curl.git
synced 2026-04-15 02:11:42 +03:00
mqtt: deal with 0 byte reads correctly
OSS-Fuzz found it Bug: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=28676 Closes #6327
This commit is contained in:
parent
c4d88f89a9
commit
a259eee99f
1 changed files with 2 additions and 2 deletions
|
|
@ -553,7 +553,7 @@ static CURLcode mqtt_doing(struct connectdata *conn, bool *done)
|
|||
case MQTT_FIRST:
|
||||
/* Read the initial byte only */
|
||||
result = Curl_read(conn, sockfd, (char *)&mq->firstbyte, 1, &nread);
|
||||
if(result)
|
||||
if(!nread)
|
||||
break;
|
||||
Curl_debug(data, CURLINFO_HEADER_IN, (char *)&mq->firstbyte, 1);
|
||||
/* remember the first byte */
|
||||
|
|
@ -563,7 +563,7 @@ static CURLcode mqtt_doing(struct connectdata *conn, bool *done)
|
|||
case MQTT_REMAINING_LENGTH:
|
||||
do {
|
||||
result = Curl_read(conn, sockfd, (char *)&byte, 1, &nread);
|
||||
if(result)
|
||||
if(!nread)
|
||||
break;
|
||||
Curl_debug(data, CURLINFO_HEADER_IN, (char *)&byte, 1);
|
||||
pkt[mq->npacket++] = byte;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue