0041-patchlevel-41.patch 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. From http://ftp.gnu.org/pub/gnu/bash/bash-4.3-patches/bash43-041
  2. Signed-off-by: Gustavo Zacarias <gustavo@zacarias.com.ar>
  3. BASH PATCH REPORT
  4. =================
  5. Bash-Release: 4.3
  6. Patch-ID: bash43-041
  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
  11. Bug-Description:
  12. There are several out-of-bounds read errors that occur when completing command
  13. lines where assignment statements appear before the command name. The first
  14. two appear only when programmable completion is enabled; the last one only
  15. happens when listing possible completions.
  16. Patch (apply with `patch -p0'):
  17. *** a/bash-4.3.40/bashline.c 2014-12-29 14:39:43.000000000 -0500
  18. --- b/bashline.c 2015-08-12 10:21:58.000000000 -0400
  19. ***************
  20. *** 1469,1476 ****
  21. --- 1469,1489 ----
  22. os = start;
  23. n = 0;
  24. + was_assignment = 0;
  25. s = find_cmd_start (os);
  26. e = find_cmd_end (end);
  27. do
  28. {
  29. + /* Don't read past the end of rl_line_buffer */
  30. + if (s > rl_end)
  31. + {
  32. + s1 = s = e1;
  33. + break;
  34. + }
  35. + /* Or past point if point is within an assignment statement */
  36. + else if (was_assignment && s > rl_point)
  37. + {
  38. + s1 = s = e1;
  39. + break;
  40. + }
  41. /* Skip over assignment statements preceding a command name. If we
  42. don't find a command name at all, we can perform command name
  43. *** a/bash-4.3.40/lib/readline/complete.c 2013-10-14 09:27:10.000000000 -0400
  44. --- b/lib/readline/complete.c 2015-07-31 09:34:39.000000000 -0400
  45. ***************
  46. *** 690,693 ****
  47. --- 690,695 ----
  48. if (temp == 0 || *temp == '\0')
  49. return (pathname);
  50. + else if (temp[1] == 0 && temp == pathname)
  51. + return (pathname);
  52. /* If the basename is NULL, we might have a pathname like '/usr/src/'.
  53. Look for a previous slash and, if one is found, return the portion
  54. *** a/bash-4.3/patchlevel.h 2012-12-29 10:47:57.000000000 -0500
  55. --- b/patchlevel.h 2014-03-20 20:01:28.000000000 -0400
  56. ***************
  57. *** 26,30 ****
  58. looks for to find the patch level (for the sccs version string). */
  59. ! #define PATCHLEVEL 40
  60. #endif /* _PATCHLEVEL_H_ */
  61. --- 26,30 ----
  62. looks for to find the patch level (for the sccs version string). */
  63. ! #define PATCHLEVEL 41
  64. #endif /* _PATCHLEVEL_H_ */