From d4b4498b43bd6be905fe243a688e18e7ba08908f Mon Sep 17 00:00:00 2001 From: Dominik Staubli Date: Wed, 7 Jul 2010 14:24:35 +0200 Subject: [PATCH] foe: size of filename truncated to 31 chars and null-terminated --- tool/CommandFoeWrite.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tool/CommandFoeWrite.cpp b/tool/CommandFoeWrite.cpp index 58094e1d..c31c7a14 100644 --- a/tool/CommandFoeWrite.cpp +++ b/tool/CommandFoeWrite.cpp @@ -139,7 +139,8 @@ void CommandFoeWrite::execute(const StringVector &args) // 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);