Commit e68bb29
committed
tools: testbench: bound control name and value copies in tb_parse_amixer
tb_parse_amixer() copies the control name and value parsed from a
control-script line into two fixed 128-byte stack buffers (control_name,
control_params) via memcpy. The copy length is derived from the quote
delimiter pointers with no upper bound:
- control_name: len = end_str - name_str - find_len, taken from the
cset name="..." quotes and never capped to TB_MAX_CTL_NAME_CHARS
- control_params: same unchecked length for the value after the closing
quote
A script line whose name or value exceeds the buffer overflows the
stack. The sibling tb_parse_sofctl() parses the same shape safely with
strndup(). Reject over-length fields before each memcpy.
Signed-off-by: jmestwa-coder <jmestwa@gmail.com>1 parent 45a3167 commit e68bb29
1 file changed
Lines changed: 8 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
368 | 368 | | |
369 | 369 | | |
370 | 370 | | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
371 | 375 | | |
372 | 376 | | |
373 | 377 | | |
374 | 378 | | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
375 | 383 | | |
376 | 384 | | |
377 | 385 | | |
| |||
0 commit comments