Skip to content

Commit

Permalink
unixsig: check for NULL altstack in drop_signals() #2842
Browse files Browse the repository at this point in the history
  • Loading branch information
dankamongmen committed Jan 14, 2025
1 parent fa7dbdc commit bbb6781
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/lib/unixsig.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@ int unblock_signals(const sigset_t* old_blocked_signals){

int drop_signals(void* nc, void** altstack){
void* expected = nc;
*altstack = NULL;
if(!altstack){
return 0;
}
if(!atomic_compare_exchange_strong(&signal_nc, &expected, NULL)){
return -1;
}
Expand Down Expand Up @@ -100,6 +102,9 @@ int unblock_signals(const sigset_t* old_blocked_signals){
int drop_signals(void* nc, void** altstack){
int ret = -1;
void* expected = nc;
if(!altstack){ // came in via signal handler
return 0;
}
*altstack = NULL;
pthread_mutex_lock(&lock);
if(atomic_compare_exchange_strong(&signal_nc, &expected, nc)){
Expand Down

0 comments on commit bbb6781

Please sign in to comment.