Skip to content

Commit

Permalink
Prevent null de-reference when using poll
Browse files Browse the repository at this point in the history
  • Loading branch information
audreylace committed Dec 8, 2023
1 parent cf21351 commit 6ce37fd
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 6ce37fd

Please sign in to comment.