mirror of
https://github.com/DarkFlippers/unleashed-firmware.git
synced 2025-12-12 12:42:30 +04:00
Replace all calls to strncpy with strlcpy, use strdup more, expose strlcat (#3866)
strlcpy doesn't zero the buffer and ensures null termination, just like snprintf strlcat is already used by mjs and it's a safe alternative to strcat, so it should be OK to expose to apps
This commit is contained in:
@@ -138,8 +138,7 @@ MJS_PRIVATE mjs_err_t to_json_or_debug(
|
||||
vp < mjs->json_visited_stack.buf + mjs->json_visited_stack.len;
|
||||
vp += sizeof(mjs_val_t)) {
|
||||
if(*(mjs_val_t*)vp == v) {
|
||||
strncpy(buf, "[Circular]", size);
|
||||
len = 10;
|
||||
len = strlcpy(buf, "[Circular]", size);
|
||||
goto clean;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user