...
Code Block | ||
---|---|---|
| ||
void handler(int signum) { signal(signum, handler); /* handlingHandle codeSignal */ } /* ... */ signal(signum, handler); |
...
Code Block | ||
---|---|---|
| ||
void handler(int signum) { /* handlingHandle codeSignal */ } /* ... */ signal(signum, handler); |
...
Code Block | ||
---|---|---|
| ||
void handler(int signum) { /* handlingHandle codeSignal */ } /* ... */ /* Equivalent to signal( signum, handler); but make signal persistent */ struct sigaction act; act.sa_handler = handler; act.sa_flags = 0; if (sigemptyset( &act.sa_mask) != 0) { /* handleHandle errorError */ } if (sigaction(signum, &act, NULL) != 0) { /* handleHandle errorError */ } |
While the handler in this example does not call signal()
, it safely can, since the signal is masked and so the handler can not be interrupted. Note that if the same handler is installed for more than one signal number, it would be necessary to mask the signals explicitly in act.sa_mask
in order to ensure the handler can not be interrupted, since the system only masks the signal being delivered.
...
Code Block | ||
---|---|---|
| ||
void handler(int signum) { #ifndef WINDOWS signal(signum, SIG_DFL); #endif /* handlingHandle codeSignal */ } /* ... */ signal(signum, handler); |
...
Recommendation | Severity | Likelihood | Remediation Cost | Priority | Level |
---|---|---|---|---|---|
SIG34-C | 1 ( low ) 1 ( | unlikely ) | 3 ( low ) | P3 | L3 |
Related Vulnerabilities
...