aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2020-04-20 17:03:18 +0200
committerDaniel Stenberg <daniel@haxx.se>2020-04-20 22:34:44 +0200
commit96c149685bff881b30493acf0fed1fc4cd5520ee (patch)
treebfce2c32f293f735160af925833e28572c556ed1
parentfa7daafdbcd41f45bf082a0e834945034bf03203 (diff)
mqtt: fix Curl_read() error handling while reading remaining length
Detected by Coverity. CID 1462320. Closes #5274
-rw-r--r--lib/mqtt.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/mqtt.c b/lib/mqtt.c
index 35c1b3e83..44433361b 100644
--- a/lib/mqtt.c
+++ b/lib/mqtt.c
@@ -569,6 +569,8 @@ static CURLcode mqtt_doing(struct connectdata *conn, bool *done)
Curl_debug(data, CURLINFO_HEADER_IN, (char *)&byte, 1);
pkt[mq->npacket++] = byte;
} while((byte & 0x80) && (mq->npacket < 4));
+ if(result)
+ break;
mq->remaining_length = mqtt_decode_len(&pkt[0], mq->npacket, NULL);
mq->npacket = 0;
if(mq->remaining_length) {