foe: size of filename truncated to 31 chars and null-terminated

This commit is contained in:
Dominik Staubli 2010-07-07 14:24:35 +02:00
parent d70f805a10
commit d4b4498b43
1 changed files with 2 additions and 1 deletions

View File

@ -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);