foe: size of filename truncated to 31 chars and null-terminated
authorDominik Staubli <ch1010252@ch10pc423>
Wed, 07 Jul 2010 14:24:35 +0200
changeset 1991 15d656ef81af
parent 1990 b0dcdfbd4238
child 1992 b1266dd6bb2f
foe: size of filename truncated to 31 chars and null-terminated
tool/CommandFoeWrite.cpp
--- a/tool/CommandFoeWrite.cpp	Wed May 12 15:07:13 2010 +0200
+++ b/tool/CommandFoeWrite.cpp	Wed Jul 07 14:24:35 2010 +0200
@@ -139,7 +139,8 @@
 
     // write data via foe to the slave
     data.offset = 0;
-    strncpy(data.file_name, storeFileName.c_str(), sizeof(data.file_name));
+    strncpy(data.file_name, storeFileName.c_str(), sizeof(data.file_name)-1);
+    data.file_name[sizeof(data.file_name)-1] = '\0';
 
     try {
         m.writeFoe(&data);