mirror of
https://github.com/DeusData/codebase-memory-mcp.git
synced 2026-11-04 10:48:20 +00:00
fix(infra): strip the ansible.builtin. prefix without strlen on the offset
GCC 13 on x86-64 (-O1, ASan/UBSan, -Werror) rejected an_key's memmove(out, out + bl, strlen(out + bl) + 1) as -Wstringop-overread, a region of size 0; arm64 GCC and clang accept it. The key length is now measured once and the prefix compared with memcmp. Every C file this branch changes compiles warning-free with that GCC. Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
This commit is contained in:
1 parent
908186334e
commit
5ca4326621
1 file changed
+3
-2
@@ -151,8 +151,9 @@ static bool an_key(const an_t *a, TSNode pair, char *out, size_t sz) {
|
||||
return false;
|
||||
}
|
||||
size_t bl = sizeof(BUILTIN) - SKIP_ONE;
|
||||
if (strncmp(out, BUILTIN, bl) == 0) {
|
||||
memmove(out, out + bl, strlen(out + bl) + SKIP_ONE);
|
||||
size_t len = strlen(out);
|
||||
if (len >= bl && memcmp(out, BUILTIN, bl) == 0) {
|
||||
memmove(out, out + bl, len - bl + SKIP_ONE);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user