Fixed possible file name overflow.
This commit is contained in:
parent
3d5d3afd26
commit
da09ae3cf9
|
|
@ -1,6 +1,6 @@
|
|||
/*****************************************************************************
|
||||
*
|
||||
* $Id$
|
||||
* $Id: CommandFoeRead.cpp,v 4f682084c643 2010/10/25 08:12:26 fp $
|
||||
*
|
||||
* Copyright (C) 2006-2009 Florian Pose, Ingenieurgemeinschaft IgH
|
||||
*
|
||||
|
|
@ -105,7 +105,7 @@ void CommandFoeRead::execute(const StringVector &args)
|
|||
data.buffer_size = 0x8800;
|
||||
data.buffer = new uint8_t[data.buffer_size];
|
||||
|
||||
strncpy(data.file_name, args[0].c_str(), sizeof(data.file_name));
|
||||
strncpy(data.file_name, args[0].c_str(), sizeof(data.file_name) - 1);
|
||||
|
||||
try {
|
||||
m.readFoe(&data);
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/*****************************************************************************
|
||||
*
|
||||
* $Id$
|
||||
* $Id: CommandFoeWrite.cpp,v 4f682084c643 2010/10/25 08:12:26 fp $
|
||||
*
|
||||
* Copyright (C) 2006-2009 Florian Pose, Ingenieurgemeinschaft IgH
|
||||
*
|
||||
|
|
@ -140,7 +140,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);
|
||||
|
||||
try {
|
||||
m.writeFoe(&data);
|
||||
|
|
|
|||
Loading…
Reference in New Issue