diff options
author | steve <steve@FreeBSD.org> | 1997-04-28 03:16:12 +0000 |
---|---|---|
committer | steve <steve@FreeBSD.org> | 1997-04-28 03:16:12 +0000 |
commit | 1da8ca45aafda53027cc0693b48ef75bfb1faccf (patch) | |
tree | c33baaa0eb82a662afa96af9dec1dca0248fc018 /bin/sh/options.c | |
parent | a503bbc21f92acc727825f200229df41b5866560 (diff) | |
download | FreeBSD-src-1da8ca45aafda53027cc0693b48ef75bfb1faccf.zip FreeBSD-src-1da8ca45aafda53027cc0693b48ef75bfb1faccf.tar.gz |
Avoid a possible NULL pointer dereference, nuke register usage,
and remove an unnecessary reset.
Obtained from: NetBSD
Diffstat (limited to 'bin/sh/options.c')
-rw-r--r-- | bin/sh/options.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/bin/sh/options.c b/bin/sh/options.c index e18bab7..9007d72 100644 --- a/bin/sh/options.c +++ b/bin/sh/options.c @@ -33,7 +33,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id$ + * $Id: options.c,v 1.12 1997/02/22 13:58:40 peter Exp $ */ #ifndef lint @@ -110,7 +110,7 @@ procargs(argc, argv) setinputfile(commandname, 0); } /* POSIX 1003.2: first arg after -c cmd is $0, remainder $1... */ - if (argptr && minusc) + if (argptr && minusc && *argptr) arg0 = *argptr++; shellparam.p = argptr; @@ -143,7 +143,7 @@ STATIC void options(cmdline) int cmdline; { - register char *p; + char *p; int val; int c; @@ -286,7 +286,6 @@ setparam(argv) shellparam.nparam = nparam; shellparam.p = newparam; shellparam.optnext = NULL; - shellparam.reset = 1; } @@ -412,7 +411,7 @@ getopts(optstr, optvar, optfirst, optnext, optptr) char ***optnext; char **optptr; { - register char *p, *q; + char *p, *q; char c = '?'; int done = 0; int ind = 0; @@ -517,7 +516,7 @@ int nextopt(optstring) char *optstring; { - register char *p, *q; + char *p, *q; char c; if ((p = optptr) == NULL || *p == '\0') { |