Commit 5767d4d
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 5767d4d
1 file changed
Lines changed: 5 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2811 | 2811 | | |
2812 | 2812 | | |
2813 | 2813 | | |
| 2814 | + | |
| 2815 | + | |
| 2816 | + | |
| 2817 | + | |
2814 | 2818 | | |
2815 | | - | |
| 2819 | + | |
2816 | 2820 | | |
2817 | 2821 | | |
2818 | 2822 | | |
| |||
0 commit comments