]> git.kaiwu.me - haproxy.git/commitdiff
BUG/MINOR: mqtt: connack parser uses wrong bit for SUBSCRIPTION_IDENTIFIERS_AVAILABLE
authorWilly Tarreau <w@1wt.eu>
Mon, 11 May 2026 13:36:08 +0000 (15:36 +0200)
committerWilly Tarreau <w@1wt.eu>
Mon, 11 May 2026 14:04:19 +0000 (16:04 +0200)
In mqtt_parse_connack(), the MQTT_PROP_SUBSCRIPTION_IDENTIFIERS_AVAILABLE
case was checking and setting MQTT_FN_BIT_SUBSCRIPTION_IDENTIFIER instead
of MQTT_FN_BIT_SUBSCRIPTION_IDENTIFIERS_AVAILABLE, due to a copy-paste
mistake. This can be backported where needed.

src/mqtt.c

index 772d683c4f569174e4551a8268377295752ef148..97839eed7236b47e443a818d565e4e1db41975b3 100644 (file)
@@ -1127,13 +1127,13 @@ static int mqtt_parse_connack(struct ist parser, struct mqtt_pkt *mpkt)
                                break;
 
                        case MQTT_PROP_SUBSCRIPTION_IDENTIFIERS_AVAILABLE:
-                               if (fields & MQTT_FN_BIT_SUBSCRIPTION_IDENTIFIER)
+                               if (fields & MQTT_FN_BIT_SUBSCRIPTION_IDENTIFIERS_AVAILABLE)
                                        goto end;
                                props = mqtt_read_1byte_int(istnext(props), &mpkt->data.connack.var_hdr.props.subscription_identifiers_available);
                                /* can have only 2 values: 0 or 1 */
                                if (mpkt->data.connack.var_hdr.props.subscription_identifiers_available > 1)
                                        goto end;
-                               fields |= MQTT_FN_BIT_SUBSCRIPTION_IDENTIFIER;
+                               fields |= MQTT_FN_BIT_SUBSCRIPTION_IDENTIFIERS_AVAILABLE;
                                break;
 
                        case MQTT_PROP_SHARED_SUBSRIPTION_AVAILABLE: