Three minor issues inherited from upstream. None urgent; grouped so they don't get lost.
Self-overlapping strncpy — workspace/all/common/config.c:556
CFG_setFontStyle() calls CFG_setFontFile(CFG_getFontFile()), and CFG_getFontFile() returns settings.fontFile — so CFG_setFontFile ends up doing:
strncpy(settings.fontFile, settings.fontFile, sizeof(settings.fontFile) - 1);
Source and destination are the same buffer. Undefined behaviour per the standard; harmless with glibc's forward copy, which is why it has never bitten.
Caught by AddressSanitizer (strncpy-param-overlap), where it aborts on startup and blocks ASan runs of the whole app — that's the real cost. I had to build with ASAN_OPTIONS=replace_str=0 to get past it while testing #1 and #2, which disables string-function checking everywhere else too.
Fix: guard the self-assignment, or have CFG_setFontStyle reload the font without routing through the setter.
map.txt double-strdup leak — Directory_index() and getRoms() in nextui.c
Hash_set() already does strdup(value) internally, but both call sites pass strdup(value) into it:
Hash_set(map, key, strdup(value)); // inner copy leaks
The outer copy is never freed. Leaks once per aliased entry on every directory load that has a map.txt. Small and bounded, but it's on a path that runs constantly while browsing.
Fix: pass value directly. The search indexer added in #2 already does it the correct way, so that call site needs no change.
Warnings
-Wall on nextui.c is not clean: several unused variables, and a -Wparentheses hit in the quick menu background path where && and || are mixed without parentheses. That one parses as intended but reads ambiguously, and it's the kind of expression that gets "fixed" wrongly later.
Three minor issues inherited from upstream. None urgent; grouped so they don't get lost.
Self-overlapping
strncpy—workspace/all/common/config.c:556CFG_setFontStyle()callsCFG_setFontFile(CFG_getFontFile()), andCFG_getFontFile()returnssettings.fontFile— soCFG_setFontFileends up doing:Source and destination are the same buffer. Undefined behaviour per the standard; harmless with glibc's forward copy, which is why it has never bitten.
Caught by AddressSanitizer (
strncpy-param-overlap), where it aborts on startup and blocks ASan runs of the whole app — that's the real cost. I had to build withASAN_OPTIONS=replace_str=0to get past it while testing #1 and #2, which disables string-function checking everywhere else too.Fix: guard the self-assignment, or have
CFG_setFontStylereload the font without routing through the setter.map.txtdouble-strdup leak —Directory_index()andgetRoms()innextui.cHash_set()already doesstrdup(value)internally, but both call sites passstrdup(value)into it:The outer copy is never freed. Leaks once per aliased entry on every directory load that has a
map.txt. Small and bounded, but it's on a path that runs constantly while browsing.Fix: pass
valuedirectly. The search indexer added in #2 already does it the correct way, so that call site needs no change.Warnings
-Wallonnextui.cis not clean: several unused variables, and a-Wparentheseshit in the quick menu background path where&&and||are mixed without parentheses. That one parses as intended but reads ambiguously, and it's the kind of expression that gets "fixed" wrongly later.