mirror of
https://github.com/opnsense/src.git
synced 2026-06-11 09:41:03 -04:00
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
This commit is contained in:
parent
413197cef9
commit
9d29fc2e4b
1 changed files with 5 additions and 0 deletions
|
|
@ -204,6 +204,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);
|
||||
|
|
|
|||
Loading…
Reference in a new issue