aboutsummaryrefslogtreecommitdiff
path: root/networking/isrv.c
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2020-02-24 10:02:50 +0100
committerDenys Vlasenko <vda.linux@googlemail.com>2020-02-24 19:20:51 +0100
commit823318822ccb0e0910abbd4e1f983637dfd9d3c0 (patch)
tree79623a9926f3e3ac979029d66b30f22f8c488fdc /networking/isrv.c
parent6cda0b04a3d3c36312adf7a9aa608306f6a5704a (diff)
downloadbusybox-823318822ccb0e0910abbd4e1f983637dfd9d3c0.tar.gz
ash: expand: Do not reprocess data when expanding words
Upstream patch: Date: Wed, 30 May 2018 02:06:03 +0800 expand: Do not reprocess data when expanding words Currently various paths will reprocess data when performing word expansion. For example, expari will skip backwards looking for the start of the arithmetic expansion, while evalvar will skip unexpanded words manually. This is cumbersome and error-prone. This patch fixes this by making word expansions proceed in a linear fashion. This means changing argstr and the various expansion functions such as expari and subevalvar to return the next character to be expanded. This is inspired by similar code from FreeBSD. However, we take things one step further and completely remove the manual word skipping in evalvar. This is accomplished by introducing a new EXP_DISCARD flag that tells argstr to only parse and not produce any actual expansions. Incidentally, argstr will now always NUL-terminate the expansion unless the EXP_WORD flag is set. This is because all but one caller of argstr wants the result to be NUL-termianted. Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> Also includes two one-line follow-up fixes: expand: Eat closing brace for length parameter if (subtype == VSLENGTH) { + p++; if (flag & EXP_DISCARD) expand: Fix double-decrement in argstr - newloc = expdest - (char *)stackblock() - end; + newloc = q - (char *)stackblock() - end; and changes in code for bash substring extensions. Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'networking/isrv.c')
0 files changed, 0 insertions, 0 deletions