summaryrefslogtreecommitdiff
path: root/os
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@oracle.com>2014-10-09 05:42:09 -0700
committerKeith Packard <keithp@keithp.com>2014-10-23 17:32:14 -0700
commit16a32c53f6e9ad1f3284d4596edfa33e9efb740e (patch)
tree00c94e9f767e42f405d8d912e5da3090c69a54ac /os
parent7e5bc49d1ed2c78c321da79bdbc99b90c5f95b38 (diff)
If fork fails in System(), don't fallthrough to exec()
In the unlikely event of a failure in creating processes, signal masks will fall from the panels above you. Secure your mask before telling your child what to do, since it won't exist, and you will instead cause the server itself to be replaced by a shell running the target program. Found by Coverity #53397: Missing break in switch Execution falls through to the next case statement or default; this might indicate a common typo. In System: Missing break statement between cases in switch statement (CWE-484) Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Matthieu Herrb <matthieu@herrb.eu> Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'os')
-rw-r--r--os/utils.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/os/utils.c b/os/utils.c
index 80415c4b0..75769f17c 100644
--- a/os/utils.c
+++ b/os/utils.c
@@ -1373,6 +1373,7 @@ System(const char *command)
switch (pid = fork()) {
case -1: /* error */
p = -1;
+ break;
case 0: /* child */
if (setgid(getgid()) == -1)
_exit(127);