summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>1999-01-10 16:45:50 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>1999-01-10 16:45:50 +0000
commit1494c2efdc94109bcd53d3092332b170ed6b8d6d (patch)
treeebe0732558f8c65f8ae262ca9df521aadb5df7b4
parent165c568427c3002d83a1ebc6d490b0c9f4936266 (diff)
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;