diff options
author | Todd C. Miller <millert@cvs.openbsd.org> | 1999-01-10 16:45:50 +0000 |
---|---|---|
committer | Todd C. Miller <millert@cvs.openbsd.org> | 1999-01-10 16:45:50 +0000 |
commit | 1494c2efdc94109bcd53d3092332b170ed6b8d6d (patch) | |
tree | ebe0732558f8c65f8ae262ca9df521aadb5df7b4 /bin | |
parent | 165c568427c3002d83a1ebc6d490b0c9f4936266 (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.
Diffstat (limited to 'bin')
-rw-r--r-- | bin/ksh/c_sh.c | 14 |
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; |