diff options
author | 2008-05-01 21:18:13 +0000 | |
---|---|---|
committer | 2008-05-01 21:18:13 +0000 | |
commit | 62a0834907e4b3fd1b9724a57d5b27caafd0bf2b (patch) | |
tree | dd34ab8846847ff51907cd18d3dd3848b250b4bb | |
parent | Be carefull not to read away the target entry when encountering (diff) | |
download | wireguard-openbsd-62a0834907e4b3fd1b9724a57d5b27caafd0bf2b.tar.xz wireguard-openbsd-62a0834907e4b3fd1b9724a57d5b27caafd0bf2b.zip |
In the main loop, do not call wait() if there is no child process yet;
misinterpreting the ``returned'' status could lead to segfauts, as reported
by ``Filth'' (hygdrasil, gmail dot com)
ok deraadt@
-rw-r--r-- | usr.bin/pmdb/pmdb.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/usr.bin/pmdb/pmdb.c b/usr.bin/pmdb/pmdb.c index 70f032d452c..d3ac2763a4e 100644 --- a/usr.bin/pmdb/pmdb.c +++ b/usr.bin/pmdb/pmdb.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pmdb.c,v 1.21 2007/08/06 19:16:05 sobrado Exp $ */ +/* $OpenBSD: pmdb.c,v 1.22 2008/05/01 21:18:13 miod Exp $ */ /* * Copyright (c) 2002 Artur Grabowski <art@openbsd.org> * All rights reserved. @@ -186,6 +186,9 @@ main(int argc, char **argv) if (ps.ps_state == TERMINATED) break; + if (ps.ps_state == NONE || ps.ps_state == LOADED) + continue; + if (wait(&status) == 0) err(1, "wait"); if (WIFEXITED(status)) { |