fix(repeater): drobnosti z review antispamu (žádný high/med, jen LOW)

Ze tří nezávislých review agentů:
- fairnessHandleCommand: `memcmp(arg, "cap ", 4)` nad 1bajtovým ""
  literálem = OOB read (UB, trip ASAN) → `strncmp` (zastaví se na NUL).
- chan_list_del trimoval jen leading space → `filter del Bob ` (RF pad
  trailing) nic nesmazal; teď trimuje oba konce jako chan_list_add.
  + test TrimsTrailingSpaceOfName.
- formatGrid: `static` scratch (nereentrantní + 448 B BSS napořád) →
  lokální; + guard max_len<=0.
- reply formátování přes snprintf(reply, reply_max) místo sprintf/strcpy
  (filter_deny je proměnné délky) — defense-in-depth.

Ostatní nálezy (spoofovatelnost jména, agresivní advert cap 4/120min
default-on) jsou zdokumentované/záměrné, ne bugy — advert default na
husté CZ síti chce ověřit gridem před stožárem.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
tthandClaude Fable 5 committed 2026-09-06 00:07:52 +02:00
1 parent 29dedf250d
commit 694c6397b7
5 files changed
+22 -9

No files matched your search

+4 -2
View File
@@ -187,9 +187,11 @@ static int fmt_deny_cat(char* out, int max_len, const char* label,
}
int FairnessLimiter::formatGrid(char* out, int max_len) const {
if (max_len <= 0) return 0;
// Work on scratch copies so the busiest-first selection can null entries as
// it consumes them without disturbing the live counters.
static uint16_t g[GROUP_MAP_SIZE], sn[SENDER_NORMAL_MAP_SIZE], sl[SENDER_LOW_MAP_SIZE];
// it consumes them without disturbing the live counters. Plain locals (~448 B
// on the stack) -- called only from the main-loop CLI path, never an ISR.
uint16_t g[GROUP_MAP_SIZE], sn[SENDER_NORMAL_MAP_SIZE], sl[SENDER_LOW_MAP_SIZE];
memcpy(g, group_deny, sizeof(g));
memcpy(sn, sender_normal_deny, sizeof(sn));
memcpy(sl, sender_low_deny, sizeof(sl));