Commit 9430290
committed
fix out_frame buffer overflow in companion radio response handlers
The onContactResponse handler copies peer response data into out_frame
(MAX_FRAME_SIZE + 1 bytes) without checking whether the data fits. A
peer response with len close to MAX_PACKET_PAYLOAD (184) writes up to
188 bytes into the 173-byte buffer, overflowing by 15 bytes.
This affects the status response, telemetry response, and binary
response code paths. A malicious peer can trigger the overflow by
sending a large response payload, corrupting the stack.
Cap each memcpy to the remaining space in out_frame before copying.1 parent e6e87fb commit 9430290
1 file changed
Lines changed: 12 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
650 | 650 | | |
651 | 651 | | |
652 | 652 | | |
653 | | - | |
654 | | - | |
| 653 | + | |
| 654 | + | |
| 655 | + | |
| 656 | + | |
655 | 657 | | |
656 | 658 | | |
657 | 659 | | |
| |||
661 | 663 | | |
662 | 664 | | |
663 | 665 | | |
664 | | - | |
665 | | - | |
| 666 | + | |
| 667 | + | |
| 668 | + | |
| 669 | + | |
666 | 670 | | |
667 | 671 | | |
668 | 672 | | |
| |||
672 | 676 | | |
673 | 677 | | |
674 | 678 | | |
675 | | - | |
676 | | - | |
| 679 | + | |
| 680 | + | |
| 681 | + | |
| 682 | + | |
677 | 683 | | |
678 | 684 | | |
679 | 685 | | |
| |||
0 commit comments