msm: 8960: replace strncpy with safer strlcpy
strncpy does not guarantee the result string is NULL-terminated. Use the
recommended alternative strlcpy instead.
CRs-fixed: 313698
Change-Id: I7b3bf684adc3ee6dcaec6614c06e3ed98156e167
Signed-off-by: Jin Hong <jinh@codeaurora.org>
diff --git a/arch/arm/mach-msm/board-msm8960.c b/arch/arm/mach-msm/board-msm8960.c
index b94a5cb..2262ba3 100644
--- a/arch/arm/mach-msm/board-msm8960.c
+++ b/arch/arm/mach-msm/board-msm8960.c
@@ -3111,8 +3111,7 @@
}
dload->magic_struct.serial_num = SERIAL_NUM_MAGIC_ID;
- strncpy(dload->serial_number, snum, SERIAL_NUMBER_LENGTH);
- dload->serial_number[SERIAL_NUMBER_LENGTH - 1] = '\0';
+ strlcpy(dload->serial_number, snum, SERIAL_NUMBER_LENGTH);
out:
iounmap(dload);
return 0;