7 Bug-Reported-by: Hanno Böck <hanno@hboeck.de>
8 Bug-Reference-ID: <20150623131106.6f111da9@pc1>, <20150707004640.0e61d2f9@pc1>
9 Bug-Reference-URL: http://lists.gnu.org/archive/html/bug-bash/2015-06/msg00089.html,
10 http://lists.gnu.org/archive/html/bug-bash/2015-07/msg00018.html
14 There are several out-of-bounds read errors that occur when completing command
15 lines where assignment statements appear before the command name. The first
16 two appear only when programmable completion is enabled; the last one only
17 happens when listing possible completions.
19 Patch (apply with `patch -p0'):
23 @@ -1468,10 +1468,23 @@ attempt_shell_completion (text, start, e
28 s = find_cmd_start (os);
29 e = find_cmd_end (end);
32 + /* Don't read past the end of rl_line_buffer */
38 + /* Or past point if point is within an assignment statement */
39 + else if (was_assignment && s > rl_point)
44 /* Skip over assignment statements preceding a command name. If we
45 don't find a command name at all, we can perform command name
46 completion. If we find a partial command name, we should perform
47 --- a/lib/readline/complete.c
48 +++ b/lib/readline/complete.c
49 @@ -689,6 +689,8 @@ printable_part (pathname)
51 if (temp == 0 || *temp == '\0')
53 + else if (temp[1] == 0 && temp == pathname)
55 /* If the basename is NULL, we might have a pathname like '/usr/src/'.
56 Look for a previous slash and, if one is found, return the portion
57 following that slash. If there's no previous slash, just return the
61 regexp `^#define[ ]*PATCHLEVEL', since that's what support/mkversion.sh
62 looks for to find the patch level (for the sccs version string). */
64 -#define PATCHLEVEL 40
65 +#define PATCHLEVEL 41
67 #endif /* _PATCHLEVEL_H_ */