Commit bb45ea3
committed
rtpengine: fix use-after-free of flags string in bencode dictionary
parse_flags() stores pointers into the pkg-allocated flags_nt.s buffer
via bencode_str() and bencode_dictionary_add_len(), which hold references
(not copies). The buffer was freed via pkg_free() before
send_rtpe_command() serialized the dictionary, causing garbled output
for key=value flags like media-address.
Fix by deferring the free via bencode_buffer_destroy_add(), which
ensures the buffer lives until bencode_buffer_free() is called after
the command is sent.
Fixes: #37841 parent dbfac4e commit bb45ea3
1 file changed
Lines changed: 7 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2638 | 2638 | | |
2639 | 2639 | | |
2640 | 2640 | | |
| 2641 | + | |
| 2642 | + | |
2641 | 2643 | | |
2642 | 2644 | | |
2643 | 2645 | | |
| |||
2811 | 2813 | | |
2812 | 2814 | | |
2813 | 2815 | | |
| 2816 | + | |
| 2817 | + | |
| 2818 | + | |
| 2819 | + | |
2814 | 2820 | | |
2815 | | - | |
| 2821 | + | |
2816 | 2822 | | |
2817 | 2823 | | |
2818 | 2824 | | |
| |||
0 commit comments