mirror of
https://github.com/curl/curl.git
synced 2025-02-17 14:59:45 +08:00
mqtt: better handling of TCP disconnect mid-message
Reported-by: Jenny Heino Bug: https://hackerone.com/reports/1521610 Closes #8644
This commit is contained in:
parent
301bd97965
commit
87da3e845b
@ -732,8 +732,14 @@ static CURLcode mqtt_doing(struct Curl_easy *data, bool *done)
|
||||
case MQTT_FIRST:
|
||||
/* Read the initial byte only */
|
||||
result = Curl_read(data, sockfd, (char *)&mq->firstbyte, 1, &nread);
|
||||
if(!nread)
|
||||
if(result)
|
||||
break;
|
||||
else if(!nread) {
|
||||
failf(data, "Connection disconnected");
|
||||
*done = TRUE;
|
||||
result = CURLE_RECV_ERROR;
|
||||
break;
|
||||
}
|
||||
Curl_debug(data, CURLINFO_HEADER_IN, (char *)&mq->firstbyte, 1);
|
||||
/* remember the first byte */
|
||||
mq->npacket = 0;
|
||||
|
Loading…
Reference in New Issue
Block a user