svn commit: r223368 - projects/jailconf/usr.sbin/jail
Jamie Gritton
jamie at FreeBSD.org
Tue Jun 21 19:13:48 UTC 2011
Author: jamie
Date: Tue Jun 21 19:13:48 2011
New Revision: 223368
URL: http://svn.freebsd.org/changeset/base/223368
Log:
Fix a couple of NULL dereferences.
Modified:
projects/jailconf/usr.sbin/jail/command.c
Modified: projects/jailconf/usr.sbin/jail/command.c
==============================================================================
--- projects/jailconf/usr.sbin/jail/command.c Tue Jun 21 17:59:51 2011 (r223367)
+++ projects/jailconf/usr.sbin/jail/command.c Tue Jun 21 19:13:48 2011 (r223368)
@@ -77,6 +77,7 @@ static int check_path(struct cfjail *j,
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:
More information about the svn-src-projects
mailing list