Skip to content

Commit

Permalink
Merge pull request #223 from audreylace/radvd-upstream-issue-pollnullptr
Browse files Browse the repository at this point in the history
Bug fix: Prevent null de-reference when using poll in main_loop
  • Loading branch information
robbat2 authored Dec 9, 2023
2 parents 446cbac + 6ce37fd commit 1063f61
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion radvd.c
Original file line number Diff line number Diff line change
Expand Up @@ -524,7 +524,9 @@ static struct Interface *main_loop(int sock, struct Interface *ifaces, char cons
#ifdef HAVE_PPOLL
int rc = ppoll(fds, sizeof(fds) / sizeof(fds[0]), tsp, &sigempty);
#else
int rc = poll(fds, sizeof(fds) / sizeof(fds[0]), 1000 * tsp->tv_sec);
// tsp could be NULL so check for this
int timeout_seconds = tsp != 0 ? 1000 * tsp->tv_sec : 0;
int rc = poll(fds, sizeof(fds) / sizeof(fds[0]), timeout_seconds);
#endif

if (rc > 0) {
Expand Down

0 comments on commit 1063f61

Please sign in to comment.