aboutsummaryrefslogtreecommitdiff
path: root/lib/connect.c
diff options
context:
space:
mode:
authorTobias Stoeckmann <tobias@stoeckmann.org>2015-03-14 14:32:42 +0100
committerDaniel Stenberg <daniel@haxx.se>2015-03-14 18:24:11 +0100
commit851c29269bbc5958cc43f2ae4f1c22eb00fa98f6 (patch)
tree9efc60a645ff80094c33ec4a17bf051e340ff5a7 /lib/connect.c
parent0cf649d9cc550af0ef5c9577d38c800be167f373 (diff)
hostip: Fix signal race in Curl_resolv_timeout.
A signal handler for SIGALRM is installed in Curl_resolv_timeout. It is configured to interrupt system calls and uses siglongjmp to return into the function if alarm() goes off. The signal handler is installed before curl_jmpenv is initialized. This means that an already installed alarm timer could trigger the newly installed signal handler, leading to undefined behavior when it accesses the uninitialized curl_jmpenv. Even if there is no previously installed alarm available, the code in Curl_resolv_timeout itself installs an alarm before the environment is fully set up. If the process is sent into suspend right after that, the signal handler could be called too early as in previous scenario. To fix this, the signal handler should only be installed and the alarm timer only be set after sigsetjmp has been called.
Diffstat (limited to 'lib/connect.c')
0 files changed, 0 insertions, 0 deletions