summaryrefslogtreecommitdiffstats
path: root/bin/sh/miscbltin.c
diff options
context:
space:
mode:
authorstefanf <stefanf@FreeBSD.org>2005-10-28 10:45:19 +0000
committerstefanf <stefanf@FreeBSD.org>2005-10-28 10:45:19 +0000
commit54091cfc827e8a2a18fc61f70f5c2fae197d6997 (patch)
tree90a53b77b5ce252eb80e70be38ddf646e528c634 /bin/sh/miscbltin.c
parent175c41b86af872bde2bead127e56ad848b0e3eb7 (diff)
downloadFreeBSD-src-54091cfc827e8a2a18fc61f70f5c2fae197d6997.zip
FreeBSD-src-54091cfc827e8a2a18fc61f70f5c2fae197d6997.tar.gz
Protect malloc, realloc and free calls with INT{ON,OFF} directly in chkalloc,
ckrealloc and ckfree (added), respectively. sh jumps out of the signal handler using longjmp which is obviously a bad idea during malloc calls. Note: I think there is still a small race here because volatile sig_atomic_t only guarantees atomic reads and writes while we're doing increments and decrements. Protect a setmode call with INT{ON,OFF} as it calls malloc internally. PR: 45478 Patch from: Nate Eldredge
Diffstat (limited to 'bin/sh/miscbltin.c')
-rw-r--r--bin/sh/miscbltin.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/bin/sh/miscbltin.c b/bin/sh/miscbltin.c
index d36f9e3..7c8981b 100644
--- a/bin/sh/miscbltin.c
+++ b/bin/sh/miscbltin.c
@@ -274,12 +274,14 @@ umaskcmd(int argc __unused, char **argv)
umask(mask);
} else {
void *set;
+ INTOFF;
if ((set = setmode (ap)) == 0)
error("Illegal number: %s", ap);
mask = getmode (set, ~mask & 0777);
umask(~mask & 0777);
free(set);
+ INTON;
}
}
return 0;
OpenPOWER on IntegriCloud