setexpr: Correct buffer overflow bug and enable tests
authorSimon Glass <sjg@chromium.org>
Sun, 1 Nov 2020 21:15:42 +0000 (14:15 -0700)
committerTom Rini <trini@konsulko.com>
Tue, 1 Dec 2020 15:33:38 +0000 (10:33 -0500)
commit8f4aa7ddb908369db971d4c31850ca1eef2e3687
tree5ef13f26cb8fa44ab01dfdb9c51abb609a476303
parent9528229f22b590cc4b5cf8bf0d3212d2ab08ffd5
setexpr: Correct buffer overflow bug and enable tests

At present when more than one substitution is made this function
overwrites its buffers. Fix this bug and update the tests now that they
can pass.

Also update the debug code to show all substrings, since at present it
omits the final one.

Fixes: 855f18ea0e6 ("setexpr: add regex substring matching and substitution")
Signed-off-by: Simon Glass <sjg@chromium.org>
cmd/setexpr.c
test/cmd/setexpr.c