mirror of
https://github.com/curl/curl.git
synced 2026-08-25 04:13:32 +03:00
servers: fix to avoid a non-signal-safe call in signal handler
`strlen()` is only guaranteed to be signal-safe since POSIX.1-2008.
Ref: https://pubs.opengroup.org/onlinepubs/009695399/functions/xsh_chap02_04.html#tag_02_04_03
Reported by Copilot
Bug: https://github.com/curl/curl/pull/22487#pullrequestreview-4863961494
Follow-up to e95f509c66 #16852
Closes #22491
This commit is contained in:
parent
518a4dadff
commit
b260e9f841
1 changed files with 4 additions and 1 deletions
|
|
@ -399,8 +399,11 @@ static void exit_signal_handler(int signum)
|
|||
}
|
||||
else {
|
||||
static const char msg[] = "exit_signal_handler: failed opening ";
|
||||
const char *str;
|
||||
(void)write(STDERR_FILENO, msg, CURL_CSTRLEN(msg));
|
||||
(void)write(STDERR_FILENO, serverlogfile, strlen(serverlogfile));
|
||||
str = serverlogfile;
|
||||
while(*str)
|
||||
(void)write(STDERR_FILENO, str++, 1);
|
||||
(void)write(STDERR_FILENO, "\n", 1);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue