Date: Wed, 28 Jan 2026 01:05:29 +0000 From: Joseph Mingrone <jrm@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org Subject: git: 1b3972ac0f75 - stable/14 - sh: Avoid referencing uninitialized memory in alias Message-ID: <697960d9.c1f2.761e35d9@gitrepo.freebsd.org>
index | next in thread | raw e-mail
The branch stable/14 has been updated by jrm: URL: https://cgit.FreeBSD.org/src/commit/?id=1b3972ac0f75c659afcd05574878cadaab4d61da commit 1b3972ac0f75c659afcd05574878cadaab4d61da Author: Joseph Mingrone <jrm@FreeBSD.org> AuthorDate: 2025-05-15 14:42:14 +0000 Commit: Joseph Mingrone <jrm@FreeBSD.org> CommitDate: 2026-01-28 01:03:36 +0000 sh: Avoid referencing uninitialized memory in alias If run as alias '' uninitialized memory could be referenced. This is based on a fix from NetBSD. For more information, refer to https://github.com/NetBSD/src/commit/10cfed82c28 . Obtained from: NetBSD (Robert Elz <kre@netbsd.org>, 10cfed82c28) MFC after: 3 days Reported by: mckusick, Robert Elz <kre@netbsd.org> Reviewed by: emaste Differential Revision: https://reviews.freebsd.org/D50364 (cherry picked from commit 9d29fc2e4bfba9fcd3b0944e683458a3f1fa0c47) --- bin/sh/alias.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/bin/sh/alias.c b/bin/sh/alias.c index 4bac525e2678..a211cd1da3d5 100644 --- a/bin/sh/alias.c +++ b/bin/sh/alias.c @@ -210,6 +210,11 @@ aliascmd(int argc __unused, char **argv __unused) return (0); } while ((n = *argptr++) != NULL) { + if (n[0] == '\0') { + warning("'': not found"); + ret = 1; + continue; + } if ((v = strchr(n+1, '=')) == NULL) /* n+1: funny ksh stuff */ if ((ap = lookupalias(n, 0)) == NULL) { warning("%s: not found", n);home | help
Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?697960d9.c1f2.761e35d9>
