freebsd-src/usr.sbin/kldxref
John Baldwin 785600d0fb kldxref: Properly handle reading strings near the end of an ELF file
If a string is at or near the end of an input file and the amount of
remaining data in the file is smaller than the maximum string size,
the pread(2) system call would return a short read which is treated as
an error.  Instead, add a new helper function for reading a string
which permits short reads so long as the data read from the file
contains a terminated string.

Reported by:	jrtc27
Reviewed by:	jrtc27
Sponsored by:	University of Cambridge, Google, Inc.
Differential Revision:	https://reviews.freebsd.org/D44419
2024-03-18 17:01:23 -07:00
..
ef.c kldxref: Properly handle reading strings near the end of an ELF file 2024-03-18 17:01:23 -07:00
ef.h kldxref: Properly handle reading strings near the end of an ELF file 2024-03-18 17:01:23 -07:00
ef_aarch64.c kldxref: Reduce divergence between per-architecture files 2023-12-14 20:17:20 +00:00
ef_amd64.c kldxref: Reduce divergence between per-architecture files 2023-12-14 20:17:20 +00:00
ef_arm.c kldxref: Reduce divergence between per-architecture files 2023-12-14 20:17:20 +00:00
ef_i386.c kldxref: Reduce divergence between per-architecture files 2023-12-14 20:17:20 +00:00
ef_mips.c kldxref: Reduce divergence between per-architecture files 2023-12-14 20:17:20 +00:00
ef_obj.c kldxref: Properly handle reading strings near the end of an ELF file 2024-03-18 17:01:23 -07:00
ef_powerpc.c kldxref: Reduce divergence between per-architecture files 2023-12-14 20:17:20 +00:00
ef_riscv.c kldxref: Reduce divergence between per-architecture files 2023-12-14 20:17:20 +00:00
elf.c kldxref: Properly handle reading strings near the end of an ELF file 2024-03-18 17:01:23 -07:00
fileformat Remove $FreeBSD$: one-line bare tag 2023-08-16 11:55:20 -06:00
kldxref.8 kldxref: Be more conservative about what we reject. 2024-01-28 21:45:23 -07:00
kldxref.c kldxref: Fix bootstrapping on macOS with Clang 16 / Apple Clang 15 2024-03-16 01:50:21 +00:00
Makefile kldxref: Add arm support 2023-12-14 18:27:09 +00:00
Makefile.depend Remove $FreeBSD$: one-line sh pattern 2023-08-16 11:55:03 -06:00