source: npl/system/bash/bash-4.3-patches/bash43-031

Last change on this file was c5c522c, checked in by Edwin Eefting <edwin@datux.nl>, 8 years ago

initial commit, transferred from cleaned syn3 svn tree

  • Property mode set to 100644
File size: 3.6 KB
RevLine 
[c5c522c]1                             BASH PATCH REPORT
2                             =================
3
4Bash-Release:   4.3
5Patch-ID:       bash43-031
6
7Bug-Reported-by:        lolilolicon <lolilolicon@gmail.com>
8Bug-Reference-ID:       <CAMtVo_Nz=32Oq=zWTb6=+8gUNXOo2rRvud1W4oPnA-cgVk_ZqQ@mail.gmail.com>
9Bug-Reference-URL:      http://lists.gnu.org/archive/html/bug-bash/2014-08/msg00139.html
10
11Bug-Description:
12
13The new nameref assignment functionality introduced in bash-4.3 did not perform
14enough validation on the variable value and would create variables with
15invalid names.
16
17Patch (apply with `patch -p0'):
18
19*** ../bash-4.3-patched/subst.h 2014-01-11 21:02:27.000000000 -0500
20--- subst.h     2014-09-01 12:16:56.000000000 -0400
21***************
22*** 48,51 ****
23--- 48,52 ----
24  #define ASS_MKGLOBAL  0x0008  /* force global assignment */
25  #define ASS_NAMEREF   0x0010  /* assigning to nameref variable */
26+ #define ASS_FROMREF   0x0020  /* assigning from value of nameref variable */
27 
28  /* Flags for the string extraction functions. */
29*** ../bash-4.3-patched/variables.c     2014-05-15 08:26:50.000000000 -0400
30--- variables.c 2014-09-01 14:37:44.000000000 -0400
31***************
32*** 2504,2511 ****
33       int hflags, aflags;
34  {
35!   char *newval;
36    SHELL_VAR *entry;
37 
38    entry = (hflags & HASH_NOSRCH) ? (SHELL_VAR *)NULL : hash_lookup (name, table);
39    /* Follow the nameref chain here if this is the global variables table */
40    if (entry && nameref_p (entry) && (invisible_p (entry) == 0) && table == global_variables->table)
41--- 2566,2590 ----
42       int hflags, aflags;
43  {
44!   char *newname, *newval;
45    SHELL_VAR *entry;
46+ #if defined (ARRAY_VARS)
47+   arrayind_t ind;
48+   char *subp;
49+   int sublen;
50+ #endif
51 
52+   newname = 0;
53+ #if defined (ARRAY_VARS)
54+   if ((aflags & ASS_FROMREF) && (hflags & HASH_NOSRCH) == 0 && valid_array_reference (name))
55+     {
56+       newname = array_variable_name (name, &subp, &sublen);
57+       if (newname == 0)
58+       return (SHELL_VAR *)NULL;       /* XXX */
59+       entry = hash_lookup (newname, table);
60+     }
61+   else
62+ #endif
63    entry = (hflags & HASH_NOSRCH) ? (SHELL_VAR *)NULL : hash_lookup (name, table);
64+
65    /* Follow the nameref chain here if this is the global variables table */
66    if (entry && nameref_p (entry) && (invisible_p (entry) == 0) && table == global_variables->table)
67***************
68*** 2538,2541 ****
69--- 2617,2630 ----
70        }
71      }
72+ #if defined (ARRAY_VARS)
73+   else if (entry == 0 && newname)
74+     {
75+       entry = make_new_array_variable (newname);      /* indexed array by default */
76+       if (entry == 0)
77+       return entry;
78+       ind = array_expand_index (name, subp, sublen);
79+       bind_array_element (entry, ind, value, aflags);
80+     }
81+ #endif
82    else if (entry == 0)
83      {
84***************
85*** 2658,2662 ****
86                      if (nameref_cell (nv) == 0)
87                        return (bind_variable_internal (nv->name, value, nvc->table, 0, flags));
88!                     return (bind_variable_internal (nameref_cell (nv), value, nvc->table, 0, flags));
89                    }
90                  else
91--- 2747,2752 ----
92                      if (nameref_cell (nv) == 0)
93                        return (bind_variable_internal (nv->name, value, nvc->table, 0, flags));
94!                     /* XXX - bug here with ref=array[index] */
95!                     return (bind_variable_internal (nameref_cell (nv), value, nvc->table, 0, flags|ASS_FROMREF));
96                    }
97                  else
98*** ../bash-4.3/patchlevel.h    2012-12-29 10:47:57.000000000 -0500
99--- patchlevel.h        2014-03-20 20:01:28.000000000 -0400
100***************
101*** 26,30 ****
102     looks for to find the patch level (for the sccs version string). */
103 
104! #define PATCHLEVEL 30
105 
106  #endif /* _PATCHLEVEL_H_ */
107--- 26,30 ----
108     looks for to find the patch level (for the sccs version string). */
109 
110! #define PATCHLEVEL 31
111 
112  #endif /* _PATCHLEVEL_H_ */
Note: See TracBrowser for help on using the repository browser.