Replace all strncpy with strlcpy

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
This commit is contained in:
Xiang Xiao
2023-03-06 00:53:04 +08:00
committed by Alin Jerpelea
parent 6f6fce95a2
commit 325f395300
7 changed files with 31 additions and 35 deletions
@@ -186,8 +186,7 @@ static int init_ota_partitions(void)
const struct ota_partition_s *part = &g_ota_partition_table[i];
mtd = progmem_alloc_mtdpart(part->offset, part->size);
strncpy(path, (char *)part->devpath, PARTITION_LABEL_LEN);
path[PARTITION_LABEL_LEN] = '\0';
strlcpy(path, (char *)part->devpath, PARTITION_LABEL_LEN);
finfo("INFO: [label]: %s\n", path);
finfo("INFO: [offset]: 0x%08" PRIx32 "\n", part->offset);
@@ -187,8 +187,7 @@ static int init_ota_partitions(void)
const struct ota_partition_s *part = &g_ota_partition_table[i];
mtd = progmem_alloc_mtdpart(part->offset, part->size);
strncpy(path, (char *)part->devpath, PARTITION_LABEL_LEN);
path[PARTITION_LABEL_LEN] = '\0';
strlcpy(path, (char *)part->devpath, PARTITION_LABEL_LEN);
finfo("INFO: [label]: %s\n", path);
finfo("INFO: [offset]: 0x%08" PRIx32 "\n", part->offset);