]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
mqtt: better too-big-message-check
authorDaniel Stenberg <daniel@haxx.se>
Tue, 13 Jan 2026 07:20:12 +0000 (08:20 +0100)
committerDaniel Stenberg <daniel@haxx.se>
Tue, 13 Jan 2026 08:46:49 +0000 (09:46 +0100)
Reported-by: gudyuu on hackerone
Reviewed-by: Daniel Gustafsson
Bug: https://hackerone.com/reports/3508500
Closes #20281

lib/mqtt.c

index 5f5c91a49a388abcfaa93c62669f9673720395ce..fc3389e7f5fd67f11e95c4300ab306999d8d80aa 100644 (file)
@@ -562,7 +562,7 @@ 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) {
+  if(remaininglength > (MAX_MQTT_MESSAGE_SIZE - encodelen - 1)) {
     result = CURLE_TOO_LARGE;
     goto fail;
   }