ash: expand: Ensure result is escaped in cvtnum
authorDenys Vlasenko <vda.linux@googlemail.com>
Fri, 21 Feb 2020 15:30:44 +0000 (16:30 +0100)
committerDenys Vlasenko <vda.linux@googlemail.com>
Fri, 21 Feb 2020 15:30:44 +0000 (16:30 +0100)
commit45dd87aac05ddf8bbfb110fde85ef875f3adfb65
tree2d18a0cc2abd0e15f4163f5dc1ce928739b8097d
parentda2e46dff6576c29fa1d379c943bb7943aa6e7ce
ash: expand: Ensure result is escaped in cvtnum

Upstream commit:

    Date: Fri, 1 Jun 2018 18:25:29 +0800
    expand: Ensure result is escaped in cvtnum

    The minus sign generated from arithmetic expansion is currently
    unquoted which causes anomalies when the result is used in where
    the quoting matters.

    This patch fixes it by explicitly calling memtodest on the result
    in cvtnum.

Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
shell/ash.c
shell/ash_test/ash-quoting/negative_arith.right [new file with mode: 0644]
shell/ash_test/ash-quoting/negative_arith.tests [new file with mode: 0755]
shell/hush_test/hush-quoting/negative_arith.right [new file with mode: 0644]
shell/hush_test/hush-quoting/negative_arith.tests [new file with mode: 0755]