[PATCH] drivers/staging/tidspbridge: using strlcpy instead of strncpy

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



  need use src lengh instead of dest length for strncpy.
  need using strlcpy instead of strncpy, for the NUL terminated string.


Signed-off-by: root <root@gchenlinux.(none)>
---
 drivers/staging/tidspbridge/rmgr/dbdcd.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/tidspbridge/rmgr/dbdcd.c b/drivers/staging/tidspbridge/rmgr/dbdcd.c
index 3d2a26f..e42a502 100644
--- a/drivers/staging/tidspbridge/rmgr/dbdcd.c
+++ b/drivers/staging/tidspbridge/rmgr/dbdcd.c
@@ -207,7 +207,7 @@ int dcd_enumerate_object(s32 index, enum dsp_dcdobjtype obj_type,
 
 		/* Create proper REG key; concatenate DCD_REGKEY with
 		 * obj_type. */
-		strncpy(sz_reg_key, DCD_REGKEY, strlen(DCD_REGKEY) + 1);
+		strlcpy(sz_reg_key, DCD_REGKEY, DCD_MAXPATHLENGTH);
 		if ((strlen(sz_reg_key) + strlen("_\0")) <
 		    DCD_MAXPATHLENGTH) {
 			strncat(sz_reg_key, "_\0", 2);
@@ -239,8 +239,8 @@ int dcd_enumerate_object(s32 index, enum dsp_dcdobjtype obj_type,
 			list_for_each_entry(dcd_key, &reg_key_list, link) {
 				if (!strncmp(dcd_key->name, sz_reg_key, len)
 						&& !index--) {
-					strncpy(sz_value, &dcd_key->name[len],
-					       strlen(&dcd_key->name[len]) + 1);
+					strlcpy(sz_value, &dcd_key->name[len],
+					       DCD_MAXPATHLENGTH);
 						break;
 				}
 			}
-- 
1.7.7.6

_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/devel


[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux