From 96c149685bff881b30493acf0fed1fc4cd5520ee Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Mon, 20 Apr 2020 17:03:18 +0200 Subject: mqtt: fix Curl_read() error handling while reading remaining length Detected by Coverity. CID 1462320. Closes #5274 --- lib/mqtt.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'lib/mqtt.c') 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) { -- cgit v1.2.3