summaryrefslogtreecommitdiffstats
path: root/lib/libc/stdlib/malloc.c
diff options
context:
space:
mode:
authoranton <anton@openbsd.org>2019-05-22 18:52:14 +0000
committeranton <anton@openbsd.org>2019-05-22 18:52:14 +0000
commit29ad4ea84fbb64add03fe0cd7967198f9ab41b26 (patch)
tree2c9144580ecea9e9e5be83bfc0ce1dec07c446d8 /lib/libc/stdlib/malloc.c
parentRead and assign the integer value only once. With this sysctl_int() will (diff)
downloadwireguard-openbsd-29ad4ea84fbb64add03fe0cd7967198f9ab41b26.tar.xz
wireguard-openbsd-29ad4ea84fbb64add03fe0cd7967198f9ab41b26.zip
A wscons device may only be opened in read/write mode once. However,
after checking for exclusive access, malloc() can sleep in wsevent_init() opening up for a potential race where more than one thread may be able open the device. Prevent this by checking if the race was won after calling malloc(). While here, switch to mallocarray as proposed by both cheloha@ and mpi@ ok mpi@
Diffstat (limited to 'lib/libc/stdlib/malloc.c')
0 files changed, 0 insertions, 0 deletions