0008-bash50-008.patch 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. From https://ftp.gnu.org/gnu/bash/bash-5.0-patches/bash50-008
  2. Signed-off-by: Pascal de Bruijn <p.debruijn@unilogic.nl>
  3. BASH PATCH REPORT
  4. =================
  5. Bash-Release: 5.0
  6. Patch-ID: bash50-008
  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. Bug-Description:
  11. When HISTSIZE is set to 0, history expansion can leave the history length
  12. set to an incorrect value, leading to subsequent attempts to access invalid
  13. memory.
  14. Patch (apply with `patch -p0'):
  15. *** ../bash-5.0-patched/bashhist.c 2018-07-05 22:41:14.000000000 -0400
  16. --- b/bashhist.c 2019-02-20 16:20:04.000000000 -0500
  17. ***************
  18. *** 561,573 ****
  19. if (!history_expansion_inhibited && history_expansion && history_expansion_p (line))
  20. {
  21. /* If we are expanding the second or later line of a multi-line
  22. command, decrease history_length so references to history expansions
  23. in these lines refer to the previous history entry and not the
  24. current command. */
  25. if (history_length > 0 && command_oriented_history && current_command_first_line_saved && current_command_line_count > 1)
  26. history_length--;
  27. expanded = history_expand (line, &history_value);
  28. if (history_length >= 0 && command_oriented_history && current_command_first_line_saved && current_command_line_count > 1)
  29. ! history_length++;
  30. if (expanded)
  31. --- 561,576 ----
  32. if (!history_expansion_inhibited && history_expansion && history_expansion_p (line))
  33. {
  34. + int old_len;
  35. +
  36. /* If we are expanding the second or later line of a multi-line
  37. command, decrease history_length so references to history expansions
  38. in these lines refer to the previous history entry and not the
  39. current command. */
  40. + old_len = history_length;
  41. if (history_length > 0 && command_oriented_history && current_command_first_line_saved && current_command_line_count > 1)
  42. history_length--;
  43. expanded = history_expand (line, &history_value);
  44. if (history_length >= 0 && command_oriented_history && current_command_first_line_saved && current_command_line_count > 1)
  45. ! history_length = old_len;
  46. if (expanded)
  47. *** ../bash-5.0/patchlevel.h 2016-06-22 14:51:03.000000000 -0400
  48. --- b/patchlevel.h 2016-10-01 11:01:28.000000000 -0400
  49. ***************
  50. *** 26,30 ****
  51. looks for to find the patch level (for the sccs version string). */
  52. ! #define PATCHLEVEL 7
  53. #endif /* _PATCHLEVEL_H_ */
  54. --- 26,30 ----
  55. looks for to find the patch level (for the sccs version string). */
  56. ! #define PATCHLEVEL 8
  57. #endif /* _PATCHLEVEL_H_ */