[PATCH 07/10] setexpr: Correct dropping of final unmatched string
Tom Rini
trini at konsulko.com
Wed Dec 2 22:23:12 CET 2020
On Sun, Nov 01, 2020 at 02:15:41PM -0700, Simon Glass wrote:
> 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: 855f18ea0e6 ("setexpr: add regex substring matching and substitution")
> Signed-off-by: Simon Glass <sjg at chromium.org>
Applied to u-boot/next, thanks!
--
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20201202/a196e9b7/attachment.sig>
More information about the U-Boot
mailing list