summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormillert <millert@openbsd.org>1999-01-10 16:45:49 +0000
committermillert <millert@openbsd.org>1999-01-10 16:45:49 +0000
commitc1d3653b82cc8c3376a6deaf77beeabf96fc566d (patch)
tree2749bde4d388646bad39debf25df7c9cf573a9f7
parentmissed in update (diff)
downloadwireguard-openbsd-c1d3653b82cc8c3376a6deaf77beeabf96fc566d.tar.xz
wireguard-openbsd-c1d3653b82cc8c3376a6deaf77beeabf96fc566d.zip
Fix bug in c_sh.c where an unitialized variable could be used.
Bug found by fgsch@openbsd.org. Patch mailed to pdksh maintainer.
-rw-r--r--bin/ksh/c_sh.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/bin/ksh/c_sh.c b/bin/ksh/c_sh.c
index bde71828b35..572df310002 100644
--- a/bin/ksh/c_sh.c
+++ b/bin/ksh/c_sh.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: c_sh.c,v 1.9 1999/01/08 20:24:57 millert Exp $ */
+/* $OpenBSD: c_sh.c,v 1.10 1999/01/10 16:45:49 millert Exp $ */
/*
* built-in Bourne commands
@@ -517,11 +517,13 @@ c_exitreturn(wp)
return 1;
arg = wp[builtin_opt.optind];
- if (arg != NULL && !getn(arg, &n)) {
- exstat = 1;
- warningf(TRUE, "%s: bad number", arg);
- } else
- exstat = n;
+ if (arg != NULL) {
+ if (!getn(arg, &n)) {
+ exstat = 1;
+ warningf(TRUE, "%s: bad number", arg);
+ } else
+ exstat = n;
+ }
if (wp[0][0] == 'r') { /* return */
struct env *ep;