mirror of
https://github.com/curl/curl.git
synced 2026-06-22 23:25:39 +03:00
mqtt: properly handle the message which exceeds maxsize
We should goto fail as topic is allocated.
Follow-up to 92fd791
Closes #19417
This commit is contained in:
parent
b0aba1005b
commit
87149c8383
1 changed files with 4 additions and 2 deletions
|
|
@ -613,8 +613,10 @@ static CURLcode mqtt_publish(struct Curl_easy *data)
|
|||
|
||||
remaininglength = payloadlen + 2 + topiclen;
|
||||
encodelen = mqtt_encode_len(encodedbytes, remaininglength);
|
||||
if(MAX_MQTT_MESSAGE_SIZE - remaininglength - 1 < encodelen)
|
||||
return CURLE_TOO_LARGE;
|
||||
if(MAX_MQTT_MESSAGE_SIZE - remaininglength - 1 < encodelen) {
|
||||
result = CURLE_TOO_LARGE;
|
||||
goto fail;
|
||||
}
|
||||
|
||||
/* add the control byte and the encoded remaining length */
|
||||
pkt = malloc(remaininglength + 1 + encodelen);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue