Skip to content

Insecure signal() API usage

Description

The signal() API is deprecated and should be replaced with sigaction() to prevent race conditions when handling multiple signals.

Examples

Insecure Code

c
signal(SIGINT, signal_handler);

Secure Code

c
struct sigaction sa; sa.sa_handler = signal_handler; sigaction(SIGINT, &sa, NULL);

Remediation

Replace signal() with sigaction() to specify the desired behavior for concurrent signals.

Rule Details

FieldValue
IDCODE-0642
CategoryGeneric
SeverityMEDIUM
CWECWE-364
ConfidenceHIGH
ImpactMEDIUM
LikelihoodMEDIUM
ExploitabilityMODERATE
Tagssignal, sigaction, race condition
OWASPN/A

References