Date: Tue, 21 Jul 2026 19:52:47 +0000 From: Bojan Novk=?utf-8?Q?ovi=C4=87?= <bnovkov@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Cc: Jane Smith <thebugfixers@pm.me> Subject: git: 9724f3f89749 - main - cat: Fix a NULL pointer dereference Message-ID: <6a5fce0f.20c88.30f7924@gitrepo.freebsd.org>
index | next in thread | raw e-mail
The branch main has been updated by bnovkov: URL: https://cgit.FreeBSD.org/src/commit/?id=9724f3f8974957d2cd15f6b796c347ca50250954 commit 9724f3f8974957d2cd15f6b796c347ca50250954 Author: Jane Smith <thebugfixers@pm.me> AuthorDate: 2026-07-21 19:45:25 +0000 Commit: Bojan Novković <bnovkov@FreeBSD.org> CommitDate: 2026-07-21 19:50:11 +0000 cat: Fix a NULL pointer dereference Check the `fdopen` return value before calling `cook_cat`. Reviewed by: markj, bnovkov Differential Revision: https://reviews.freebsd.org/D57741 MFC after: 1 week --- bin/cat/cat.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/bin/cat/cat.c b/bin/cat/cat.c index c4c04fb3fff6..8c10faf7cff9 100644 --- a/bin/cat/cat.c +++ b/bin/cat/cat.c @@ -259,7 +259,8 @@ scanfiles(char *argv[], int cooked __unused) if (fd == STDIN_FILENO) cook_cat(stdin); else { - fp = fdopen(fd, "r"); + if ((fp = fdopen(fd, "r")) == NULL) + err(1, "fdopen"); cook_cat(fp); fclose(fp); }home | help
Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?6a5fce0f.20c88.30f7924>
