Commit c41ea69
committed
fix coap_parse_parms: use-after-free on uninitialized buf_t pointer
coap_parse_parms declared buf_t *b without initializing to NULL.
When parse_var_bytes returned 0 (e.g. empty input), it did not write
to its output parameter, leaving b as a garbage pointer. The
subsequent bfree(b) freed an arbitrary address.
Initialize b to 0 so bfree is a safe no-op on the error path.
Found by libFuzzer with AddressSanitizer:
ef hex coap-parms par1 parent 51f1429 commit c41ea69
1 file changed
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
80 | 80 | | |
81 | 81 | | |
82 | 82 | | |
83 | | - | |
| 83 | + | |
84 | 84 | | |
85 | 85 | | |
86 | 86 | | |
| |||
0 commit comments