[Coverity] Copy into fixed size buffer (STRING_OVERFLOW)

This commit is contained in:
Peter D. Barnes, Jr.
2013-05-15 09:56:21 -04:00
parent 71f388c000
commit 426f22be0c
2 changed files with 5 additions and 1 deletions

View File

@@ -24,6 +24,7 @@
#include "ns3/snr-to-block-error-rate-record.h"
#include "default-traces.h"
#include "ns3/log.h"
#include "ns3/assert.h"
#include <fstream>
NS_LOG_COMPONENT_DEFINE ("SNRToBlockErrorRateManager");
@@ -273,6 +274,8 @@ SNRToBlockErrorRateManager::ReLoadTraces (void)
void
SNRToBlockErrorRateManager::SetTraceFilePath (char *traceFilePath)
{
NS_ASSERT_MSG (std::strlen (traceFilePath) < TRACE_FILE_PATH_SIZE,
"char * traceFilePath too long");
std::strcpy (m_traceFilePath, traceFilePath);
}

View File

@@ -94,7 +94,8 @@ private:
void ClearRecords (void);
double m_speed; // in m/s
uint8_t m_activateLoss;
char m_traceFilePath[1024];
static const unsigned int TRACE_FILE_PATH_SIZE = 1024;
char m_traceFilePath[TRACE_FILE_PATH_SIZE];
std::vector<SNRToBlockErrorRateRecord *> * m_recordModulation[7];