u-boot-brain/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
..
arm command: Remove the cmd_tbl_t typedef 2020-05-18 18:36:55 -04:00
broadcom cmd: broadcom: add command for chimp handshake 2020-09-09 16:57:35 -04:00
mvebu Convert CONFIG_SYS_MMC_ENV_DEV et al to Kconfig 2020-08-08 11:03:52 -04:00
riscv cmd: provide command sbi 2020-08-25 09:34:47 +08:00
ti common: Drop log.h from common header 2020-05-18 21:19:18 -04:00
x86 x86: Add support for more than 8 MTRRs 2020-09-25 11:27:27 +08:00
.gitignore cmd: rework "license" command 2017-02-08 15:56:28 -05:00
ab_select.c command: Remove the cmd_tbl_t typedef 2020-05-18 18:36:55 -04:00
abootimg.c command: Remove the cmd_tbl_t typedef 2020-05-18 18:36:55 -04:00
acpi.c cmd: acpi: Print revisions in hex format 2020-09-21 16:41:35 +08:00
adc.c command: Remove the cmd_tbl_t typedef 2020-05-18 18:36:55 -04:00
adtimg.c command: Remove the cmd_tbl_t typedef 2020-05-18 18:36:55 -04:00
aes.c command: Remove the cmd_tbl_t typedef 2020-05-18 18:36:55 -04:00
armflash.c command: Remove the cmd_tbl_t typedef 2020-05-18 18:36:55 -04:00
avb.c cmd: avb: free partition buffer upon verify completion 2020-05-19 14:01:47 -04:00
axi.c common: Drop log.h from common header 2020-05-18 21:19:18 -04:00
bcb.c common: Drop log.h from common header 2020-05-18 21:19:18 -04:00
bdinfo.c x86: video: Show information about each video device 2020-09-25 11:27:27 +08:00
bedbug.c global: Move from bi_memstart/memsize -> gd->ram_base/ram_size 2020-08-26 09:19:34 +02:00
bind.c cmd: bind: allow to bind driver with driver data 2020-08-22 07:58:39 -06:00
binop.c command: Remove the cmd_tbl_t typedef 2020-05-18 18:36:55 -04:00
blk_common.c command: Remove the cmd_tbl_t typedef 2020-05-18 18:36:55 -04:00
blkcache.c command: Remove the cmd_tbl_t typedef 2020-05-18 18:36:55 -04:00
blob.c command: Remove the cmd_tbl_t typedef 2020-05-18 18:36:55 -04:00
bloblist.c bloblist: Add a command 2020-10-06 09:07:54 -06:00
bmp.c common: Drop log.h from common header 2020-05-18 21:19:18 -04:00
boot.c command: Remove the cmd_tbl_t typedef 2020-05-18 18:36:55 -04:00
bootcount.c command: Remove the cmd_tbl_t typedef 2020-05-18 18:36:55 -04:00
bootefi.c efi_loader: consider no-map property of reserved memory 2020-10-06 07:43:56 +02:00
booti.c cmd: booti: convert the debug print about image move to printf 2020-07-17 08:51:01 -04:00
bootm.c treewide: convert bd_t to struct bd_info manually 2020-07-17 10:46:44 -04:00
bootmenu.c common: rename getc() to getchar() 2020-10-22 09:54:53 -04:00
bootstage.c command: Remove the cmd_tbl_t typedef 2020-05-18 18:36:55 -04:00
bootz.c cmd: bootz: fix device-tree overlap test 2020-08-05 08:18:34 -04:00
btrfs.c command: Remove the cmd_tbl_t typedef 2020-05-18 18:36:55 -04:00
button.c cmd/button: return button status 2020-10-14 11:16:34 -04:00
cache.c command: Remove the cmd_tbl_t typedef 2020-05-18 18:36:55 -04:00
cbfs.c cbfs: Return the error code from file_cbfs_init() 2020-05-27 14:40:09 +08:00
clk.c cmd: clk: correctly handle depth for clk dump 2020-08-24 11:03:26 +02:00
clone.c cmd: fix clone coverity scan 2020-08-24 14:11:31 -04:00
cls.c command: Remove the cmd_tbl_t typedef 2020-05-18 18:36:55 -04:00
config.c command: Remove the cmd_tbl_t typedef 2020-05-18 18:36:55 -04:00
conitrace.c cmd: conitrace: replace getc() by getchar() 2020-11-09 17:28:17 +01:00
console.c command: Remove the cmd_tbl_t typedef 2020-05-18 18:36:55 -04:00
cpu.c command: Remove the cmd_tbl_t typedef 2020-05-18 18:36:55 -04:00
cramfs.c command: Remove the cmd_tbl_t typedef 2020-05-18 18:36:55 -04:00
cros_ec.c common: Drop log.h from common header 2020-05-18 21:19:18 -04:00
dataflash_mmc_mux.c command: Remove the cmd_tbl_t typedef 2020-05-18 18:36:55 -04:00
date.c command: Remove the cmd_tbl_t typedef 2020-05-18 18:36:55 -04:00
demo.c cmd: demo: Remove duplicated help message for list subcommand 2020-08-14 15:18:30 -04:00
dfu.c command: Remove the cmd_tbl_t typedef 2020-05-18 18:36:55 -04:00
diag.c command: Remove the cmd_tbl_t typedef 2020-05-18 18:36:55 -04:00
disk.c common: Drop log.h from common header 2020-05-18 21:19:18 -04:00
dm.c cmd: dm: Fixed/Added DM driver listing subcommands 2020-07-07 15:37:13 -04:00
echo.c command: Remove the cmd_tbl_t typedef 2020-05-18 18:36:55 -04:00
eeprom.c common: Drop linux/delay.h from common header 2020-05-18 21:19:23 -04:00
efi.c efi: clean up efi command 2020-09-06 21:21:41 +02:00
efidebug.c efi_loader: efidebug display RNG protocol 2020-09-27 16:10:45 +02:00
elf.c common: Drop log.h from common header 2020-05-18 21:19:18 -04:00
ethsw.c command: Remove the cmd_tbl_t typedef 2020-05-18 18:36:55 -04:00
exit.c command: Remove the cmd_tbl_t typedef 2020-05-18 18:36:55 -04:00
ext2.c command: Remove the cmd_tbl_t typedef 2020-05-18 18:36:55 -04:00
ext4.c command: Remove the cmd_tbl_t typedef 2020-05-18 18:36:55 -04:00
fastboot.c common: Drop linux/stringify.h from common header 2020-05-18 21:19:23 -04:00
fat.c cmd: fat: Use do_save() for fatwrite 2020-10-23 13:33:07 -04:00
fdt.c cmd: fdt: remove CMD_FDT_MAX_DUMP 2020-07-09 18:57:22 -06:00
flash.c common: Drop log.h from common header 2020-05-18 21:19:18 -04:00
fpga.c common: Drop log.h from common header 2020-05-18 21:19:18 -04:00
fpgad.c command: Remove the cmd_tbl_t typedef 2020-05-18 18:36:55 -04:00
fs_uuid.c command: Remove the cmd_tbl_t typedef 2020-05-18 18:36:55 -04:00
fs.c cmd: fs: Add command to list supported fs types 2020-07-07 15:36:59 -04:00
fuse.c command: Remove the cmd_tbl_t typedef 2020-05-18 18:36:55 -04:00
gettime.c command: Remove the cmd_tbl_t typedef 2020-05-18 18:36:55 -04:00
gpio.c common: Drop log.h from common header 2020-05-18 21:19:18 -04:00
gpt.c common: Drop log.h from common header 2020-05-18 21:19:18 -04:00
hash.c command: Remove the cmd_tbl_t typedef 2020-05-18 18:36:55 -04:00
help.c command: Remove the cmd_tbl_t typedef 2020-05-18 18:36:55 -04:00
host.c cmd: host: return value of do_host_bind() 2020-07-28 19:30:39 -06:00
i2c.c common: Drop linux/delay.h from common header 2020-05-18 21:19:23 -04:00
ide.c command: Remove the cmd_tbl_t typedef 2020-05-18 18:36:55 -04:00
ini.c command: Remove the cmd_tbl_t typedef 2020-05-18 18:36:55 -04:00
io.c command: Remove the cmd_tbl_t typedef 2020-05-18 18:36:55 -04:00
iotrace.c command: Remove the cmd_tbl_t typedef 2020-05-18 18:36:55 -04:00
irq.c command: Remove the cmd_tbl_t typedef 2020-05-18 18:36:55 -04:00
itest.c command: Add constants for cmd_get_data_size string / error 2020-12-01 10:33:38 -05:00
jffs2.c common: Drop linux/bug.h from common header 2020-05-18 21:19:23 -04:00
Kconfig cmd: log: Add commands to manipulate filters 2020-10-30 10:56:11 -04:00
led.c command: Remove the cmd_tbl_t typedef 2020-05-18 18:36:55 -04:00
legacy_led.c command: Remove the cmd_tbl_t typedef 2020-05-18 18:36:55 -04:00
legacy-mtd-utils.c cmd: nand/sf: isolate legacy code 2019-12-04 17:10:51 -05:00
legacy-mtd-utils.h cmd: nand/sf: isolate legacy code 2019-12-04 17:10:51 -05:00
license.c command: Remove the cmd_tbl_t typedef 2020-05-18 18:36:55 -04:00
load.c common: rename getc() to getchar() 2020-10-22 09:54:53 -04:00
log.c cmd: log: Add commands to manipulate filters 2020-10-30 10:56:11 -04:00
lsblk.c cmd: fix lsblk command 2020-07-16 12:37:02 +02:00
lzmadec.c command: Remove the cmd_tbl_t typedef 2020-05-18 18:36:55 -04:00
mac.c command: Remove the cmd_tbl_t typedef 2020-05-18 18:36:55 -04:00
Makefile Merge https://gitlab.denx.de/u-boot/custodians/u-boot-fsl-qoriq 2020-10-29 09:10:24 -04:00
md5sum.c command: Remove the cmd_tbl_t typedef 2020-05-18 18:36:55 -04:00
mdio.c net: Drop dm.h header file from phy.h 2020-08-03 22:19:54 -04:00
mem.c command: Add constants for cmd_get_data_size string / error 2020-12-01 10:33:38 -05:00
mfsl.c command: Remove the cmd_tbl_t typedef 2020-05-18 18:36:55 -04:00
mii.c net: Drop dm.h header file from phy.h 2020-08-03 22:19:54 -04:00
misc.c cmd: Add a 'misc' command to access miscellaneous devices 2020-10-23 13:33:07 -04:00
mmc.c cmd: mmc: Cache-align extcsd read target 2020-06-24 09:51:22 +08:00
mp.c command: Remove the cmd_tbl_t typedef 2020-05-18 18:36:55 -04:00
mtd.c command: Remove the cmd_tbl_t typedef 2020-05-18 18:36:55 -04:00
mtdparts.c common: Drop log.h from common header 2020-05-18 21:19:18 -04:00
mux.c cmd: Add a mux command 2020-10-28 11:49:31 -04:00
nand.c command: Remove the cmd_tbl_t typedef 2020-05-18 18:36:55 -04:00
net.c sntp: use udp framework 2020-09-30 16:55:03 -04:00
nvedit_efi.c efi_loader: use ':' as separator for setenv -i 2020-08-24 16:37:53 +02:00
nvedit.c efi: change 'env -e -i' usage syntax 2020-09-18 22:23:58 +02:00
nvme.c command: Remove the cmd_tbl_t typedef 2020-05-18 18:36:55 -04:00
onenand.c command: Remove the cmd_tbl_t typedef 2020-05-18 18:36:55 -04:00
optee_rpmb.c cmd: optee_rpmb command for read/write of rpmb from optee 2020-10-23 16:52:09 +05:30
osd.c command: Remove the cmd_tbl_t typedef 2020-05-18 18:36:55 -04:00
panic.c cmd: add a panic command 2020-07-08 17:21:46 -04:00
part.c cmd: part: Add subcommand to list supported partition tables 2020-07-07 15:22:42 -04:00
pcap.c command: Remove the cmd_tbl_t typedef 2020-05-18 18:36:55 -04:00
pci.c command: Remove the cmd_tbl_t typedef 2020-05-18 18:36:55 -04:00
pinmux.c command: Remove the cmd_tbl_t typedef 2020-05-18 18:36:55 -04:00
pmc.c command: Remove the cmd_tbl_t typedef 2020-05-18 18:36:55 -04:00
pmic.c command: Remove the cmd_tbl_t typedef 2020-05-18 18:36:55 -04:00
pstore.c cmd: Fixup DT to pass PStore Ramoops parameters 2020-10-14 11:16:34 -04:00
pvblock.c xen: pvblock: Add initial support for para-virtualized block driver 2020-08-14 15:18:30 -04:00
pxe_utils.c cmd: pxe: Use internal FDT if retrieving from FDTDIR fails 2020-12-01 10:33:37 -05:00
pxe_utils.h command: Remove the cmd_tbl_t typedef 2020-05-18 18:36:55 -04:00
pxe.c cmd: pxe: Add relocation to pxe_sub cmds 2020-09-23 14:29:57 +02:00
qfw.c command: Remove the cmd_tbl_t typedef 2020-05-18 18:36:55 -04:00
read.c command: Remove the cmd_tbl_t typedef 2020-05-18 18:36:55 -04:00
reginfo.c command: Remove the cmd_tbl_t typedef 2020-05-18 18:36:55 -04:00
regulator.c command: Remove the cmd_tbl_t typedef 2020-05-18 18:36:55 -04:00
reiser.c command: Remove the cmd_tbl_t typedef 2020-05-18 18:36:55 -04:00
remoteproc.c command: Remove the cmd_tbl_t typedef 2020-05-18 18:36:55 -04:00
rng.c command: Remove the cmd_tbl_t typedef 2020-05-18 18:36:55 -04:00
rockusb.c command: Remove the cmd_tbl_t typedef 2020-05-18 18:36:55 -04:00
rtc.c rtc: add rtc command 2020-07-09 06:02:45 +02:00
sata.c command: Remove the cmd_tbl_t typedef 2020-05-18 18:36:55 -04:00
sb.c command: Remove the cmd_tbl_t typedef 2020-05-18 18:36:55 -04:00
scsi.c command: Remove the cmd_tbl_t typedef 2020-05-18 18:36:55 -04:00
setexpr.c setexpr: Correct dropping of final unmatched string 2020-12-01 10:33:38 -05:00
sf.c spi: Convert CONFIG_DM_SPI* to CONFIG_$(SPL_TPL_)DM_SPI* 2020-06-29 13:34:43 -04:00
sha1sum.c command: Remove the cmd_tbl_t typedef 2020-05-18 18:36:55 -04:00
sleep.c cmd: Split out timer command from the sleep command 2020-10-23 13:33:07 -04:00
smccc.c command: Remove the cmd_tbl_t typedef 2020-05-18 18:36:55 -04:00
sound.c command: Remove the cmd_tbl_t typedef 2020-05-18 18:36:55 -04:00
source.c common: Drop log.h from common header 2020-05-18 21:19:18 -04:00
spi.c spi: Convert CONFIG_DM_SPI* to CONFIG_$(SPL_TPL_)DM_SPI* 2020-06-29 13:34:43 -04:00
spl.c common: Drop log.h from common header 2020-05-18 21:19:18 -04:00
sqfs.c fs/squashfs: add filesystem commands 2020-08-07 22:31:32 -04:00
strings.c command: Remove the cmd_tbl_t typedef 2020-05-18 18:36:55 -04:00
sysboot.c command: Remove the cmd_tbl_t typedef 2020-05-18 18:36:55 -04:00
terminal.c command: Remove the cmd_tbl_t typedef 2020-05-18 18:36:55 -04:00
test.c common: Drop log.h from common header 2020-05-18 21:19:18 -04:00
thordown.c command: Remove the cmd_tbl_t typedef 2020-05-18 18:36:55 -04:00
time.c command: Remove the cmd_tbl_t typedef 2020-05-18 18:36:55 -04:00
timer.c cmd: Split out timer command from the sleep command 2020-10-23 13:33:07 -04:00
tlv_eeprom.c command: Remove the cmd_tbl_t typedef 2020-05-18 18:36:55 -04:00
tpm_test.c common: Drop log.h from common header 2020-05-18 21:19:18 -04:00
tpm-common.c command: Remove the cmd_tbl_t typedef 2020-05-18 18:36:55 -04:00
tpm-user-utils.h command: Remove the cmd_tbl_t typedef 2020-05-18 18:36:55 -04:00
tpm-v1.c command: Remove the cmd_tbl_t typedef 2020-05-18 18:36:55 -04:00
tpm-v2.c tpm: Change response length of tpm2_get_capability() 2020-11-09 17:28:18 +01:00
trace.c command: Remove the cmd_tbl_t typedef 2020-05-18 18:36:55 -04:00
tsi148.c common: Drop log.h from common header 2020-05-18 21:19:18 -04:00
ubi.c command: Remove the cmd_tbl_t typedef 2020-05-18 18:36:55 -04:00
ubifs.c common: Drop log.h from common header 2020-05-18 21:19:18 -04:00
ufs.c command: Remove the cmd_tbl_t typedef 2020-05-18 18:36:55 -04:00
universe.c command: Remove the cmd_tbl_t typedef 2020-05-18 18:36:55 -04:00
unlz4.c command: Remove the cmd_tbl_t typedef 2020-05-18 18:36:55 -04:00
unzip.c command: Remove the cmd_tbl_t typedef 2020-05-18 18:36:55 -04:00
usb_gadget_sdp.c command: Remove the cmd_tbl_t typedef 2020-05-18 18:36:55 -04:00
usb_mass_storage.c usb: gadget: Fix controller index in UMS 2020-09-01 14:47:43 +02:00
usb.c command: Remove the cmd_tbl_t typedef 2020-05-18 18:36:55 -04:00
version.c command: Remove the cmd_tbl_t typedef 2020-05-18 18:36:55 -04:00
virtio.c command: Remove the cmd_tbl_t typedef 2020-05-18 18:36:55 -04:00
w1.c w1: Drop dm.h header file 2020-08-03 22:19:54 -04:00
wdt.c command: Remove the cmd_tbl_t typedef 2020-05-18 18:36:55 -04:00
wol.c command: Remove the cmd_tbl_t typedef 2020-05-18 18:36:55 -04:00
ximg.c command: Remove the cmd_tbl_t typedef 2020-05-18 18:36:55 -04:00
yaffs2.c command: Remove the cmd_tbl_t typedef 2020-05-18 18:36:55 -04:00
zfs.c command: Remove the cmd_tbl_t typedef 2020-05-18 18:36:55 -04:00
zip.c cmd: zip: fix implicit declaration warning 2020-05-25 11:54:53 -04:00