Problem
A 18-line hand-rolled case-insensitive suffix check is duplicated verbatim in both src/main.c:18-36 and src/extensions.c:123-141:
\\c
for (size_t i = 0; i < lf; i++) {
unsigned char a = (unsigned char)tail[i];
unsigned char b = (unsigned char)suffix[i];
if ((unsigned char)tolower(a) != (unsigned char)tolower(b)) { return 0; }
}
\
common.h already ships prefix_stricmp. This can be prefix_stricmp(tail, suffix) == 0.
Fix
Delete both copies, move a single inline version to common.h, or use prefix_stricmp directly at the 4 call sites.
Reported by Kilo Code (automated audit tool), not a human reviewer.
Problem
A 18-line hand-rolled case-insensitive suffix check is duplicated verbatim in both src/main.c:18-36 and src/extensions.c:123-141:
\\c
for (size_t i = 0; i < lf; i++) {
unsigned char a = (unsigned char)tail[i];
unsigned char b = (unsigned char)suffix[i];
if ((unsigned char)tolower(a) != (unsigned char)tolower(b)) { return 0; }
}
\
common.h already ships prefix_stricmp. This can be prefix_stricmp(tail, suffix) == 0.
Fix
Delete both copies, move a single inline version to common.h, or use prefix_stricmp directly at the 4 call sites.
Reported by Kilo Code (automated audit tool), not a human reviewer.