mboxd_pnor_partition_table: Avoid using strcpy
Instead use strncpy() and specify the size of the destination buf, then
null-terminate the result.
Change-Id: I02b50010d4ba11feed5a96f27b3ec2bb50b2eabf
Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
diff --git a/mboxd_pnor_partition_table.cpp b/mboxd_pnor_partition_table.cpp
index decf048..49afeb0 100644
--- a/mboxd_pnor_partition_table.cpp
+++ b/mboxd_pnor_partition_table.cpp
@@ -21,10 +21,14 @@
{
int rc;
- strcpy(context->paths.ro_loc, PARTITION_FILES_RO_LOC);
- strcpy(context->paths.rw_loc, PARTITION_FILES_RW_LOC);
- strcpy(context->paths.prsv_loc, PARTITION_FILES_PRSV_LOC);
- strcpy(context->paths.patch_loc, PARTITION_FILES_PATCH_LOC);
+ strncpy(context->paths.ro_loc, PARTITION_FILES_RO_LOC, PATH_MAX);
+ context->paths.ro_loc[PATH_MAX - 1] = '\0';
+ strncpy(context->paths.rw_loc, PARTITION_FILES_RW_LOC, PATH_MAX);
+ context->paths.rw_loc[PATH_MAX - 1] = '\0';
+ strncpy(context->paths.prsv_loc, PARTITION_FILES_PRSV_LOC, PATH_MAX);
+ context->paths.prsv_loc[PATH_MAX - 1] = '\0';
+ strncpy(context->paths.patch_loc, PARTITION_FILES_PATCH_LOC, PATH_MAX);
+ context->paths.prsv_loc[PATH_MAX - 1] = '\0';
rc = vpnor_create_partition_table_from_path(context,
PARTITION_FILES_RO_LOC);