summaryrefslogtreecommitdiffstats
path: root/bin/sh/exec.c
diff options
context:
space:
mode:
authorgreid <greid@FreeBSD.org>2002-04-15 15:49:30 +0000
committergreid <greid@FreeBSD.org>2002-04-15 15:49:30 +0000
commit5486a1c99e83e46d84c69055664f7be76949b884 (patch)
treef16d7c51bc2a2a6445d3841d56a626ead18c3388 /bin/sh/exec.c
parentd44a434afa9bef4610bf21cc0e98424982cbb84b (diff)
downloadFreeBSD-src-5486a1c99e83e46d84c69055664f7be76949b884.zip
FreeBSD-src-5486a1c99e83e46d84c69055664f7be76949b884.tar.gz
Stop a null pointer dereference in the builtin hash function.
PR: 36141 Approved by: cracauer MFC after: 1 week
Diffstat (limited to 'bin/sh/exec.c')
-rw-r--r--bin/sh/exec.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/bin/sh/exec.c b/bin/sh/exec.c
index e4948fe..718ef82 100644
--- a/bin/sh/exec.c
+++ b/bin/sh/exec.c
@@ -350,7 +350,10 @@ hashcmd(int argc __unused, char **argv __unused)
if (verbose) {
if (entry.cmdtype != CMDUNKNOWN) { /* if no error msg */
cmdp = cmdlookup(name, 0);
- printentry(cmdp, verbose);
+ if (cmdp != NULL)
+ printentry(cmdp, verbose);
+ else
+ outfmt(&errout, "%s: not found\n", name);
}
flushall();
}
OpenPOWER on IntegriCloud