[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

segfault with address@hidden@A}

From: Grisha Levit
Subject: segfault with address@hidden@A}
Date: Sun, 29 Jul 2018 17:49:33 -0400

If `var' is declared but not set, performing an @A or @a
transformation on double-quoted address@hidden' or `var[*]' will trigger a
segfault in dequote_string.

This is present in 4.4 and devel.

    bash -c 'declare var; echo "address@hidden@A}"'
    Segmentation fault: 11

This seems like the easy fix:

diff --git a/subst.c b/subst.c
index dbb38fae..2ae4a1ec 100644
--- a/subst.c
+++ b/subst.c
@@ -7320,7 +7320,7 @@ get_var_and_type (varname, value, ind, quoted,
flags, varp, valp)
          vtype = VT_VARIABLE;
          *varp = v;
          if (quoted & (Q_DOUBLE_QUOTES|Q_HERE_DOCUMENT))
-           *valp = dequote_string (value);
+           *valp = value ? dequote_string (value) : savestring("");
            *valp = dequote_escapes (value);

reply via email to

[Prev in Thread] Current Thread [Next in Thread]