Fixed possible file name overflow.

This commit is contained in:
Florian Pose
2020-04-03 11:45:15 +02:00
parent 2570ab3345
commit 580ede82df
2 changed files with 5 additions and 4 deletions

View File

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

View File

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