bash52-010.patch 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. BASH PATCH REPORT
  2. =================
  3. Bash-Release: 5.2
  4. Patch-ID: bash52-010
  5. Bug-Reported-by: larsh@apache.org
  6. Bug-Reference-ID:
  7. Bug-Reference-URL: https://savannah.gnu.org/support/?110744
  8. Bug-Description:
  9. Bash-5.2 checks the first 128 characters of an executable file that execve()
  10. refuses to execute to see whether it's a binary file before trying to
  11. execute it as a shell script. This defeats some previously-supported use
  12. cases like "self-executing" jar files or "self-uncompressing" scripts.
  13. Patch (apply with `patch -p0'):
  14. *** ../bash-5.2-patched/general.c 2022-11-07 10:31:42.000000000 -0500
  15. --- general.c 2022-11-18 14:48:45.000000000 -0500
  16. ***************
  17. *** 684,687 ****
  18. --- 684,688 ----
  19. {
  20. register int i;
  21. + int nline;
  22. unsigned char c;
  23. ***************
  24. *** 690,702 ****
  25. /* Generally we check the first line for NULs. If the first line looks like
  26. ! a `#!' interpreter specifier, we just look for NULs anywhere in the
  27. ! buffer. */
  28. ! if (sample[0] == '#' && sample[1] == '!')
  29. ! return (memchr (sample, '\0', sample_len) != NULL);
  30. for (i = 0; i < sample_len; i++)
  31. {
  32. c = sample[i];
  33. ! if (c == '\n')
  34. return (0);
  35. if (c == '\0')
  36. --- 691,701 ----
  37. /* Generally we check the first line for NULs. If the first line looks like
  38. ! a `#!' interpreter specifier, we look for NULs in the first two lines. */
  39. ! nline = (sample[0] == '#' && sample[1] == '!') ? 2 : 1;
  40. for (i = 0; i < sample_len; i++)
  41. {
  42. c = sample[i];
  43. ! if (c == '\n' && --nline == 0)
  44. return (0);
  45. if (c == '\0')
  46. *** ../bash-5.2/patchlevel.h 2020-06-22 14:51:03.000000000 -0400
  47. --- patchlevel.h 2020-10-01 11:01:28.000000000 -0400
  48. ***************
  49. *** 26,30 ****
  50. looks for to find the patch level (for the sccs version string). */
  51. ! #define PATCHLEVEL 9
  52. #endif /* _PATCHLEVEL_H_ */
  53. --- 26,30 ----
  54. looks for to find the patch level (for the sccs version string). */
  55. ! #define PATCHLEVEL 10
  56. #endif /* _PATCHLEVEL_H_ */