bash51-009 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. BASH PATCH REPORT
  2. =================
  3. Bash-Release: 5.1
  4. Patch-ID: bash51-009
  5. Bug-Reported-by: Julien Moutinho <julm+bash@sourcephile.fr>
  6. Bug-Reference-ID: <20211004035906.5kiobuzkpeckmvwg@sourcephile.fr>
  7. Bug-Reference-URL: https://lists.gnu.org/archive/html/bug-bash/2021-10/msg00022.html
  8. Bug-Description:
  9. The bash malloc implementation of malloc_usable_size() does not follow the
  10. specification. This can cause library functions that use it to overwrite
  11. memory bounds checking.
  12. Patch (apply with `patch -p0'):
  13. *** ../bash-5.1-patched/lib/malloc/malloc.c 2020-07-08 10:19:30.000000000 -0400
  14. --- lib/malloc/malloc.c 2021-10-05 16:10:55.000000000 -0400
  15. ***************
  16. *** 1287,1297 ****
  17. }
  18. ! /* XXX - should we return 0 if ISFREE? */
  19. ! maxbytes = binsize(p->mh_index);
  20. !
  21. ! /* So the usable size is the maximum number of bytes in the bin less the
  22. ! malloc overhead */
  23. ! maxbytes -= MOVERHEAD + MSLOP;
  24. ! return (maxbytes);
  25. }
  26. --- 1358,1367 ----
  27. }
  28. ! /* return 0 if ISFREE */
  29. ! if (p->mh_alloc == ISFREE)
  30. ! return 0;
  31. !
  32. ! /* Since we use bounds checking, the usable size is the last requested size. */
  33. ! return (p->mh_nbytes);
  34. }
  35. *** ../bash-5.1/patchlevel.h 2020-06-22 14:51:03.000000000 -0400
  36. --- patchlevel.h 2020-10-01 11:01:28.000000000 -0400
  37. ***************
  38. *** 26,30 ****
  39. looks for to find the patch level (for the sccs version string). */
  40. ! #define PATCHLEVEL 8
  41. #endif /* _PATCHLEVEL_H_ */
  42. --- 26,30 ----
  43. looks for to find the patch level (for the sccs version string). */
  44. ! #define PATCHLEVEL 9
  45. #endif /* _PATCHLEVEL_H_ */