Module Name: src Committed By: mrg Date: Thu Aug 10 20:36:29 UTC 2023
Modified Files: src/external/bsd/pdisk/dist: io.c src/usr.bin/find: misc.c src/usr.bin/mail: extern.h fio.c thread.c thread.h src/usr.bin/rs: rs.c src/usr.bin/sort: files.c Log Message: avoid various use-after-free issues. create a ptrdiff_t offset between the start of an allocation region and some interesting pointer, so it can be adjusted with this offset after realloc() returns. for pdisk(), realloc() is a locally inlind malloc() and free() pair. for mail(1), this required a little bit more effort as the old pointer was passed into another file for fix-ups there, and that code needed to be adjusted for offset vs old pointer usage. found by GCC 12. To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/external/bsd/pdisk/dist/io.c cvs rdiff -u -r1.15 -r1.16 src/usr.bin/find/misc.c cvs rdiff -u -r1.35 -r1.36 src/usr.bin/mail/extern.h cvs rdiff -u -r1.43 -r1.44 src/usr.bin/mail/fio.c cvs rdiff -u -r1.14 -r1.15 src/usr.bin/mail/thread.c cvs rdiff -u -r1.2 -r1.3 src/usr.bin/mail/thread.h cvs rdiff -u -r1.16 -r1.17 src/usr.bin/rs/rs.c cvs rdiff -u -r1.42 -r1.43 src/usr.bin/sort/files.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.