diff options
author | jamie <jamie@FreeBSD.org> | 2011-06-21 19:13:48 +0000 |
---|---|---|
committer | jamie <jamie@FreeBSD.org> | 2011-06-21 19:13:48 +0000 |
commit | 6c5b20bbbbdcec03a157cce051d6f9e9e56b2874 (patch) | |
tree | aa048ef1dbff518dfb54ba906451f72ab65a72bd | |
parent | 6811668a5f8d31f9754803ba22ad926b39c67e0c (diff) | |
download | FreeBSD-src-6c5b20bbbbdcec03a157cce051d6f9e9e56b2874.zip FreeBSD-src-6c5b20bbbbdcec03a157cce051d6f9e9e56b2874.tar.gz |
Fix a couple of NULL dereferences.
-rw-r--r-- | usr.sbin/jail/command.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/usr.sbin/jail/command.c b/usr.sbin/jail/command.c index eaaab15..1692f1c 100644 --- a/usr.sbin/jail/command.c +++ b/usr.sbin/jail/command.c @@ -77,6 +77,7 @@ static int check_path(struct cfjail *j, const char *pname, const char *path, static struct cfjails sleeping = TAILQ_HEAD_INITIALIZER(sleeping); static struct cfjails runnable = TAILQ_HEAD_INITIALIZER(runnable); +static struct cfstring dummystring = { .len = 1 }; static struct phhead phash[PHASH_SIZE]; static int kq; @@ -89,8 +90,6 @@ next_command(struct cfjail *j) enum intparam comparam; int rval, create_failed; - static struct cfstring dummystring = { .len = 1 }; - rval = 0; create_failed = (j->flags & (JF_STOP | JF_FAILED)) == JF_FAILED; for (; (comparam = *j->comparam); @@ -115,7 +114,8 @@ next_command(struct cfjail *j) } } for (; j->comstring != NULL; - j->comstring = create_failed + j->comstring = j->comstring == &dummystring ? NULL : + create_failed ? TAILQ_PREV(j->comstring, cfstrings, tq) : TAILQ_NEXT(j->comstring, tq)) { if (rval != 0) @@ -457,7 +457,7 @@ run_command(struct cfjail *j) TAILQ_FOREACH(s, &j->intparams[IP_COMMAND]->val, tq) argv[argc++] = s->s; argv[argc] = NULL; - j->comstring = NULL; + j->comstring = &dummystring; break; default: |