diff options
author | Otto Moerbeek <otto@cvs.openbsd.org> | 2003-12-16 19:32:46 +0000 |
---|---|---|
committer | Otto Moerbeek <otto@cvs.openbsd.org> | 2003-12-16 19:32:46 +0000 |
commit | 1c0c88d62ffb0a769d2c771a2ff19fcf3b044ae2 (patch) | |
tree | e16281ea257958568e40d1040a90aadc130b20cf /usr.bin | |
parent | 9d6eff126736d10f13664f4d62ef39c5d08bfaa2 (diff) |
Avoid segmentation fault when empty commands are specified in the
config file; resolves PR 3578.
ok deraadt@ millert@
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/newsyslog/newsyslog.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/usr.bin/newsyslog/newsyslog.c b/usr.bin/newsyslog/newsyslog.c index 8e4090cd527..2f5a1c8e695 100644 --- a/usr.bin/newsyslog/newsyslog.c +++ b/usr.bin/newsyslog/newsyslog.c @@ -1,4 +1,4 @@ -/* $OpenBSD: newsyslog.c,v 1.75 2003/07/25 10:28:53 mpech Exp $ */ +/* $OpenBSD: newsyslog.c,v 1.76 2003/12/16 19:32:45 otto Exp $ */ /* * Copyright (c) 1999, 2002, 2003 Todd C. Miller <Todd.Miller@courtesan.com> @@ -71,7 +71,7 @@ */ #ifndef lint -static const char rcsid[] = "$OpenBSD: newsyslog.c,v 1.75 2003/07/25 10:28:53 mpech Exp $"; +static const char rcsid[] = "$OpenBSD: newsyslog.c,v 1.76 2003/12/16 19:32:45 otto Exp $"; #endif /* not lint */ #ifndef CONF @@ -243,10 +243,10 @@ main(int argc, char **argv) struct pidinfo *pltmp; for (pltmp = pidlist; pltmp < pl; pltmp++) { - if ((q->pidfile && + if ((q->pidfile && pltmp->file && strcmp(pltmp->file, q->pidfile) == 0 && pltmp->signal == q->signal) || - (q->runcmd && + (q->runcmd && pltmp->file && strcmp(q->runcmd, pltmp->file) == 0)) break; } @@ -265,7 +265,7 @@ main(int argc, char **argv) } /* Step 3, send a signal or run a command */ - for (pl = pidlist; pl->file; pl++) { + for (pl--; pl >= pidlist; pl--) { if (pl->file != NULL) { if (pl->signal == -1) run_command(pl->file); |