Skip to content

Commit d910b3c

Browse files
committed
init sigaction to 0 with memset
1 parent 0ca3743 commit d910b3c

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

src/node.cc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -489,6 +489,7 @@ void TrapWebAssemblyOrContinue(int signo, siginfo_t* info, void* ucontext) {
489489
} else {
490490
// Reset to the default signal handler, i.e. cause a hard crash.
491491
struct sigaction sa;
492+
memset(&sa, 0, sizeof(sa));
492493
sa.sa_handler = SIG_DFL;
493494
sigemptyset(&sa.sa_mask);
494495
sa.sa_flags = 0;
@@ -515,6 +516,7 @@ void RegisterSignalHandler(int signal,
515516
}
516517
#endif // NODE_USE_V8_WASM_TRAP_HANDLER
517518
struct sigaction sa;
519+
memset(&sa, 0, sizeof(sa));
518520
sa.sa_sigaction = handler;
519521
sigfillset(&sa.sa_mask);
520522
sa.sa_flags = reset_handler ? SA_RESETHAND : 0;
@@ -565,6 +567,7 @@ inline void PlatformInit() {
565567
#ifndef NODE_SHARED_MODE
566568
// Restore signal dispositions, the parent process may have changed them.
567569
struct sigaction act;
570+
memset(&act, 0, sizeof(act));
568571
sigemptyset(&act.sa_mask);
569572
act.sa_flags = 0;
570573

@@ -617,6 +620,7 @@ inline void PlatformInit() {
617620
// and pass the signal context to V8.
618621
{
619622
struct sigaction sa;
623+
memset(&sa, 0, sizeof(sa));
620624
sa.sa_sigaction = TrapWebAssemblyOrContinue;
621625
sigemptyset(&sa.sa_mask);
622626
sa.sa_flags = 0;

src/node_main.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ int main(int argc, char* argv[]) {
102102
// removed.
103103
{
104104
struct sigaction act;
105+
memset(&act, 0, sizeof(act));
105106
act.sa_handler = SIG_IGN;
106107
sigemptyset(&act.sa_mask);
107108
act.sa_flags = 0;

0 commit comments

Comments
 (0)