Commit b430f2c
committed
Fix: Enforce MQTT v5 property-packet validation and improve decoding safety
Implements necessary protocol validation in MqttEncode_Props and
MqttDecode_Props to ensure that properties are only used in their
allowed packet types, addressing the 'TODO: validate packet type'.
- Defines new error code: MQTT_CODE_ERROR_PROPERTY_MISMATCH.
- Adds critical buffer boundary checks in MqttDecode_Props before
VBI and string decoding to prevent potential buffer overruns.
Signed-off-by: Badr Bacem KAABIA <badrbacemkaabia@gmail.com>1 parent ab2088a commit b430f2c
2 files changed
Lines changed: 25 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
377 | 377 | | |
378 | 378 | | |
379 | 379 | | |
380 | | - | |
381 | 380 | | |
382 | 381 | | |
383 | 382 | | |
384 | 383 | | |
385 | | - | |
386 | | - | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
387 | 394 | | |
388 | 395 | | |
389 | 396 | | |
| |||
505 | 512 | | |
506 | 513 | | |
507 | 514 | | |
508 | | - | |
509 | | - | |
| 515 | + | |
| 516 | + | |
510 | 517 | | |
511 | 518 | | |
512 | 519 | | |
| 520 | + | |
513 | 521 | | |
514 | 522 | | |
515 | 523 | | |
| |||
520 | 528 | | |
521 | 529 | | |
522 | 530 | | |
523 | | - | |
524 | | - | |
525 | | - | |
526 | 531 | | |
527 | 532 | | |
528 | 533 | | |
529 | 534 | | |
530 | 535 | | |
| 536 | + | |
| 537 | + | |
| 538 | + | |
| 539 | + | |
| 540 | + | |
| 541 | + | |
531 | 542 | | |
532 | 543 | | |
533 | 544 | | |
| |||
561 | 572 | | |
562 | 573 | | |
563 | 574 | | |
| 575 | + | |
| 576 | + | |
| 577 | + | |
| 578 | + | |
| 579 | + | |
564 | 580 | | |
565 | 581 | | |
566 | 582 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
202 | 202 | | |
203 | 203 | | |
204 | 204 | | |
| 205 | + | |
205 | 206 | | |
206 | 207 | | |
207 | 208 | | |
| |||
0 commit comments