CERT.SIG.SIG_HANDLER.ASYNC_SAFE

Call only asynchronous-safe functions within signal handlers.

Vulnerability and risk

Invoking functions that are not asynchronous-safe from within a signal handler is undefined behavior.

Mitigation and prevention

For strictly conforming programs, only the C standard library functions abort(), _Exit(), quick_exit(), and signal() can be safely called from within a signal handler.

In general, it is not safe to invoke I/O functions from within signal handlers. Programmers should ensure a function is included in the list of an implementation's asynchronous-safe functions for all implementations the code will run on before using them in signal handlers.