! return (bind_variable_internal (nameref_cell (nv), value, nvc->table, 0, flags|ASS_FROMREF));
From http://ftp.gnu.org/pub/gnu/bash/bash-4.3-patches/bash43-031
Signed-off-by: Gustavo Zacarias <gustavo@zacarias.com.ar>
Bug-Reported-by: lolilolicon <lolilolicon@gmail.com>
Bug-Reference-ID: <CAMtVo_Nz=32Oq=zWTb6=+8gUNXOo2rRvud1W4oPnA-cgVk_ZqQ@mail.gmail.com>
Bug-Reference-URL: http://lists.gnu.org/archive/html/bug-bash/2014-08/msg00139.html
The new nameref assignment functionality introduced in bash-4.3 did not perform
enough validation on the variable value and would create variables with
Patch (apply with `patch -p0'):
*** a/bash-4.3-patched/subst.h 2014-01-11 21:02:27.000000000 -0500
--- b/subst.h 2014-09-01 12:16:56.000000000 -0400
#define ASS_MKGLOBAL 0x0008 /* force global assignment */
#define ASS_NAMEREF 0x0010 /* assigning to nameref variable */
+ #define ASS_FROMREF 0x0020 /* assigning from value of nameref variable */
/* Flags for the string extraction functions. */
*** a/bash-4.3-patched/variables.c 2014-05-15 08:26:50.000000000 -0400
--- b/variables.c 2014-09-01 14:37:44.000000000 -0400
entry = (hflags & HASH_NOSRCH) ? (SHELL_VAR *)NULL : hash_lookup (name, table);
/* Follow the nameref chain here if this is the global variables table */
if (entry && nameref_p (entry) && (invisible_p (entry) == 0) && table == global_variables->table)
! char *newname, *newval;
+ #if defined (ARRAY_VARS)
+ #if defined (ARRAY_VARS)
+ if ((aflags & ASS_FROMREF) && (hflags & HASH_NOSRCH) == 0 && valid_array_reference (name))
+ newname = array_variable_name (name, &subp, &sublen);
+ return (SHELL_VAR *)NULL; /* XXX */
+ entry = hash_lookup (newname, table);