]>
Commit | Line | Data |
---|---|---|
415fb8b5 PM |
1 | BASH PATCH REPORT |
2 | ================= | |
3 | ||
4 | Bash-Release: 5.0 | |
5 | Patch-ID: bash50-008 | |
6 | ||
7 | Bug-Reported-by: Michael Albinus <michael.albinus@gmx.de> | |
8 | Bug-Reference-ID: <87bm36k3kz.fsf@gmx.de> | |
9 | Bug-Reference-URL: https://lists.gnu.org/archive/html/bug-bash/2019-02/msg00111.html | |
10 | ||
11 | Bug-Description: | |
12 | ||
13 | When HISTSIZE is set to 0, history expansion can leave the history length | |
14 | set to an incorrect value, leading to subsequent attempts to access invalid | |
15 | memory. | |
16 | ||
17 | Patch (apply with `patch -p0'): | |
18 | ||
19 | *** ../bash-5.0-patched/bashhist.c 2018-07-05 22:41:14.000000000 -0400 | |
20 | --- bashhist.c 2019-02-20 16:20:04.000000000 -0500 | |
21 | *************** | |
22 | *** 561,573 **** | |
23 | if (!history_expansion_inhibited && history_expansion && history_expansion_p (line)) | |
24 | { | |
25 | /* If we are expanding the second or later line of a multi-line | |
26 | command, decrease history_length so references to history expansions | |
27 | in these lines refer to the previous history entry and not the | |
28 | current command. */ | |
29 | if (history_length > 0 && command_oriented_history && current_command_first_line_saved && current_command_line_count > 1) | |
30 | history_length--; | |
31 | expanded = history_expand (line, &history_value); | |
32 | if (history_length >= 0 && command_oriented_history && current_command_first_line_saved && current_command_line_count > 1) | |
33 | ! history_length++; | |
34 | ||
35 | if (expanded) | |
36 | --- 561,576 ---- | |
37 | if (!history_expansion_inhibited && history_expansion && history_expansion_p (line)) | |
38 | { | |
39 | + int old_len; | |
40 | + | |
41 | /* If we are expanding the second or later line of a multi-line | |
42 | command, decrease history_length so references to history expansions | |
43 | in these lines refer to the previous history entry and not the | |
44 | current command. */ | |
45 | + old_len = history_length; | |
46 | if (history_length > 0 && command_oriented_history && current_command_first_line_saved && current_command_line_count > 1) | |
47 | history_length--; | |
48 | expanded = history_expand (line, &history_value); | |
49 | if (history_length >= 0 && command_oriented_history && current_command_first_line_saved && current_command_line_count > 1) | |
50 | ! history_length = old_len; | |
51 | ||
52 | if (expanded) | |
53 | ||
54 | *** ../bash-5.0/patchlevel.h 2016-06-22 14:51:03.000000000 -0400 | |
55 | --- patchlevel.h 2016-10-01 11:01:28.000000000 -0400 | |
56 | *************** | |
57 | *** 26,30 **** | |
58 | looks for to find the patch level (for the sccs version string). */ | |
59 | ||
60 | ! #define PATCHLEVEL 7 | |
61 | ||
62 | #endif /* _PATCHLEVEL_H_ */ | |
63 | --- 26,30 ---- | |
64 | looks for to find the patch level (for the sccs version string). */ | |
65 | ||
66 | ! #define PATCHLEVEL 8 | |
67 | ||
68 | #endif /* _PATCHLEVEL_H_ */ |