From 2aa5d9ee375e5d17345cc7bb0e040a990509f5a1 Mon Sep 17 00:00:00 2001 From: bol-van Date: Mon, 8 Jun 2026 09:54:40 +0300 Subject: [PATCH] nfqws2: minor optimize --- docs/changes.txt | 1 + nfq2/timer.c | 9 ++++++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/docs/changes.txt b/docs/changes.txt index 5813a70..2b4dcbb 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -302,3 +302,4 @@ v0.9.4.3 1.0.1 * install_easy: do not use apk in openwrt if it doesn't have db in /lib/apk/db +* nfqws2: fix UAF if a timer is deleted in timer function diff --git a/nfq2/timer.c b/nfq2/timer.c index b86c8e5..abd23fb 100644 --- a/nfq2/timer.c +++ b/nfq2/timer.c @@ -93,8 +93,11 @@ uint64_t TimerPoolNext(const timer_pool *p, bool *dirty) } uint64_t TimerPoolRun(timer_pool **pp, bool *dirty, uint64_t bt) { - *dirty = false; - if (!*pp) return 0; // no timers + if (!*pp) + { + *dirty = false; + return 0; // no timers + } timer_pool *elem, *tmp, *p; char *name; @@ -146,6 +149,6 @@ again: } if (elem && (elem->bt_next < mintime)) mintime = elem->bt_next; } - if (!*pp) return 0; // no timers, no dirty + if (!*pp) return 0; // no timers return mintime; }