increase the version number of Dragora
[dragora.git] / patches / bash / bash44-009
blob26a054af48c9cd5d91bf84cf3e0c6912226b28e8
1                              BASH PATCH REPORT
2                              =================
4 Bash-Release:   4.4
5 Patch-ID:       bash44-009
7 Bug-Reported-by:        Hong Cho <hong.cho@citrix.com>
8 Bug-Reference-ID:       <c30b5fe62b2543af8297e47ca487c29c@SJCPEX02CL02.citrite.net>
9 Bug-Reference-URL:      http://lists.gnu.org/archive/html/bug-bash/2016-12/msg00043.html
11 Bug-Description:
13 There is a race condition in add_history() that can be triggered by a fatal
14 signal arriving between the time the history length is updated and the time
15 the history list update is completed. A later attempt to reference an
16 invalid history entry can cause a crash.
18 Patch (apply with `patch -p0'):
20 *** ../bash-4.4-patched/lib/readline/history.c  2016-11-11 13:42:49.000000000 -0500
21 --- lib/readline/history.c      2016-12-05 10:37:51.000000000 -0500
22 ***************
23 *** 280,283 ****
24 --- 280,284 ----
25   {
26     HIST_ENTRY *temp;
27 +   int new_length;
28   
29     if (history_stifled && (history_length == history_max_entries))
30 ***************
31 *** 296,306 ****
32         /* Copy the rest of the entries, moving down one slot.  Copy includes
33          trailing NULL.  */
34 - #if 0
35 -       for (i = 0; i < history_length; i++)
36 -       the_history[i] = the_history[i + 1];
37 - #else
38         memmove (the_history, the_history + 1, history_length * sizeof (HIST_ENTRY *));
39 - #endif
40   
41         history_base++;
42       }
43 --- 297,303 ----
44         /* Copy the rest of the entries, moving down one slot.  Copy includes
45          trailing NULL.  */
46         memmove (the_history, the_history + 1, history_length * sizeof (HIST_ENTRY *));
47   
48 +       new_length = history_length;
49         history_base++;
50       }
51 ***************
52 *** 316,320 ****
53             history_size = DEFAULT_HISTORY_INITIAL_SIZE;
54           the_history = (HIST_ENTRY **)xmalloc (history_size * sizeof (HIST_ENTRY *));
55 !         history_length = 1;
56         }
57         else
58 --- 313,317 ----
59             history_size = DEFAULT_HISTORY_INITIAL_SIZE;
60           the_history = (HIST_ENTRY **)xmalloc (history_size * sizeof (HIST_ENTRY *));
61 !         new_length = 1;
62         }
63         else
64 ***************
65 *** 326,330 ****
66                 xrealloc (the_history, history_size * sizeof (HIST_ENTRY *));
67             }
68 !         history_length++;
69         }
70       }
71 --- 323,327 ----
72                 xrealloc (the_history, history_size * sizeof (HIST_ENTRY *));
73             }
74 !         new_length = history_length + 1;
75         }
76       }
77 ***************
78 *** 332,337 ****
79     temp = alloc_history_entry ((char *)string, hist_inittime ());
80   
81 !   the_history[history_length] = (HIST_ENTRY *)NULL;
82 !   the_history[history_length - 1] = temp;
83   }
84   
85 --- 329,335 ----
86     temp = alloc_history_entry ((char *)string, hist_inittime ());
87   
88 !   the_history[new_length] = (HIST_ENTRY *)NULL;
89 !   the_history[new_length - 1] = temp;
90 !   history_length = new_length;
91   }
92   
93 *** ../bash-4.4/patchlevel.h    2016-06-22 14:51:03.000000000 -0400
94 --- patchlevel.h        2016-10-01 11:01:28.000000000 -0400
95 ***************
96 *** 26,30 ****
97      looks for to find the patch level (for the sccs version string). */
98   
99 ! #define PATCHLEVEL 8
100   
101   #endif /* _PATCHLEVEL_H_ */
102 --- 26,30 ----
103      looks for to find the patch level (for the sccs version string). */
104   
105 ! #define PATCHLEVEL 9
106   
107   #endif /* _PATCHLEVEL_H_ */