[U-Boot] [PATCH] fs:fat: fix set file name function

Piotr Wilczek p.wilczek at samsung.com
Fri Oct 11 15:43:33 CEST 2013


Curently memcpy copies string without null terminating char because
function strlen returns only number of characters excluding
null terminating character. Replace memcpy with strcpy.

Signed-off-by: Piotr Wilczek <p.wilczek at samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park at samsung.com>
CC: Tom Rini <trini at ti.com>
---
 fs/fat/fat_write.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/fat/fat_write.c b/fs/fat/fat_write.c
index b7a21e0..9f5e911 100644
--- a/fs/fat/fat_write.c
+++ b/fs/fat/fat_write.c
@@ -57,7 +57,7 @@ static void set_name(dir_entry *dirent, const char *filename)
 	if (len == 0)
 		return;
 
-	memcpy(s_name, filename, len);
+	strcpy(s_name, filename);
 	uppercase(s_name, len);
 
 	period = strchr(s_name, '.');
-- 
1.7.9.5



More information about the U-Boot mailing list