git: 4990a7d344d9 - stable/14 - devmatch: Catch truncated linker hints files
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 30 Oct 2024 13:21:12 UTC
The branch stable/14 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=4990a7d344d985668917d00cde0675c042cd5649 commit 4990a7d344d985668917d00cde0675c042cd5649 Author: Mark Johnston <markj@FreeBSD.org> AuthorDate: 2024-10-23 16:55:16 +0000 Commit: Mark Johnston <markj@FreeBSD.org> CommitDate: 2024-10-30 13:21:06 +0000 devmatch: Catch truncated linker hints files PR: 282268 Reviewed by: christos, imp MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D47243 (cherry picked from commit 9b2f2fbfcbc51f77e96a41e62b1c06a8ccd4ca15) --- sbin/devmatch/devmatch.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/sbin/devmatch/devmatch.c b/sbin/devmatch/devmatch.c index 2485120c57b6..d961a1e92daa 100644 --- a/sbin/devmatch/devmatch.c +++ b/sbin/devmatch/devmatch.c @@ -127,6 +127,12 @@ read_linker_hints(void) err(1, "Can't open %s for reading", fn); } + if (len < sizeof(int)) { + warnx("Linker hints file too short."); + free(hints); + hints = NULL; + return; + } if (*(int *)(intptr_t)hints != LINKER_HINTS_VERSION) { warnx("Linker hints version %d doesn't match expected %d.", *(int *)(intptr_t)hints, LINKER_HINTS_VERSION);