u-boot-brain/test/cmd
Simon Glass 9528229f22 setexpr: Correct dropping of final unmatched string
At present the 'nlen' variable increases with each loop. If the previous
loop had back references, then subsequent loops without back references
use the wrong value of nlen. The value is larger, meaning that the string
terminator from nbuf is copied along to the main buffer, thus terminating
the string prematurely.

This leads to the final result being truncated, e.g. missing the last
(unmatched) part of the string. So "match match tail" become
"replaced replaced" instead of "replaced replaced tail".

Fix this by resetting nlen to the correct value each time around the lop.

Fixes: 855f18ea0e ("setexpr: add regex substring matching and substitution")
Signed-off-by: Simon Glass <sjg@chromium.org>
2020-12-01 10:33:38 -05:00
..
Makefile test: Add some tests for setexpr 2020-12-01 10:33:38 -05:00
mem_search.c cmd: Update the memory-search command 2020-08-07 22:31:32 -04:00
mem.c cmd: Update the memory-search command 2020-08-07 22:31:32 -04:00
setexpr.c setexpr: Correct dropping of final unmatched string 2020-12-01 10:33:38 -05:00