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:
Silent
2024-09-07 18:16:56 +02:00
committed by GitHub
parent 9bdf41d8ff
commit 8672a1d94c
18 changed files with 47 additions and 47 deletions

View File

@@ -99,7 +99,7 @@ static void furi_hal_version_set_name(const char* name) {
"xFlipper %s",
furi_hal_version.name);
} else {
snprintf(furi_hal_version.device_name, FURI_HAL_VERSION_DEVICE_NAME_LENGTH, "xFlipper");
strlcpy(furi_hal_version.device_name, "xFlipper", FURI_HAL_VERSION_DEVICE_NAME_LENGTH);
}
furi_hal_version.device_name[0] = AD_TYPE_COMPLETE_LOCAL_NAME;