You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

67 lines
2.1 KiB

  1. BASH PATCH REPORT
  2. =================
  3. Bash-Release: 4.3
  4. Patch-ID: bash43-041
  5. Bug-Reported-by: Hanno Böck <hanno@hboeck.de>
  6. Bug-Reference-ID: <20150623131106.6f111da9@pc1>, <20150707004640.0e61d2f9@pc1>
  7. Bug-Reference-URL: http://lists.gnu.org/archive/html/bug-bash/2015-06/msg00089.html,
  8. http://lists.gnu.org/archive/html/bug-bash/2015-07/msg00018.html
  9. Bug-Description:
  10. There are several out-of-bounds read errors that occur when completing command
  11. lines where assignment statements appear before the command name. The first
  12. two appear only when programmable completion is enabled; the last one only
  13. happens when listing possible completions.
  14. Patch (apply with `patch -p0'):
  15. --- a/bashline.c
  16. +++ b/bashline.c
  17. @@ -1468,10 +1468,23 @@ attempt_shell_completion (text, start, e
  18. os = start;
  19. n = 0;
  20. + was_assignment = 0;
  21. s = find_cmd_start (os);
  22. e = find_cmd_end (end);
  23. do
  24. {
  25. + /* Don't read past the end of rl_line_buffer */
  26. + if (s > rl_end)
  27. + {
  28. + s1 = s = e1;
  29. + break;
  30. + }
  31. + /* Or past point if point is within an assignment statement */
  32. + else if (was_assignment && s > rl_point)
  33. + {
  34. + s1 = s = e1;
  35. + break;
  36. + }
  37. /* Skip over assignment statements preceding a command name. If we
  38. don't find a command name at all, we can perform command name
  39. completion. If we find a partial command name, we should perform
  40. --- a/lib/readline/complete.c
  41. +++ b/lib/readline/complete.c
  42. @@ -689,6 +689,8 @@ printable_part (pathname)
  43. if (temp == 0 || *temp == '\0')
  44. return (pathname);
  45. + else if (temp[1] == 0 && temp == pathname)
  46. + return (pathname);
  47. /* If the basename is NULL, we might have a pathname like '/usr/src/'.
  48. Look for a previous slash and, if one is found, return the portion
  49. following that slash. If there's no previous slash, just return the
  50. --- a/patchlevel.h
  51. +++ b/patchlevel.h
  52. @@ -25,6 +25,6 @@
  53. regexp `^#define[ ]*PATCHLEVEL', since that's what support/mkversion.sh
  54. looks for to find the patch level (for the sccs version string). */
  55. -#define PATCHLEVEL 40
  56. +#define PATCHLEVEL 41
  57. #endif /* _PATCHLEVEL_H_ */