msm: ramdump: Replace strncpy() and strncat() with a safer alternative
Using snprintf() is safer than the previous implementation since
it leaves room for a NUL character at the end of the destination
string and cannot overflow it.
Change-Id: I6041fecdf9303dcafe741c4520581a1434bb8b01
Signed-off-by: Matt Wagantall <mattw@codeaurora.org>
diff --git a/arch/arm/mach-msm/ramdump.c b/arch/arm/mach-msm/ramdump.c
index 962371b..53128ad 100644
--- a/arch/arm/mach-msm/ramdump.c
+++ b/arch/arm/mach-msm/ramdump.c
@@ -198,8 +198,8 @@
return NULL;
}
- strncpy(rd_dev->name, "ramdump_", 256);
- strncat(rd_dev->name, dev_name, 256);
+ snprintf(rd_dev->name, ARRAY_SIZE(rd_dev->name), "ramdump_%s",
+ dev_name);
init_completion(&rd_dev->ramdump_complete);