Skip to content

Commit 96cf5f6

Browse files
committed
fix: Potentially overrunning write with float to string conversion
1 parent 68c21f6 commit 96cf5f6

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

evgMrmApp/src/evgEvtClk.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11

22
#include <stdio.h>
3-
#include <errlog.h>
3+
#include <errlog.h>
44
#include <stdexcept>
55
#include <sstream>
66

7-
#include <mrfCommonIO.h>
8-
#include <mrfCommon.h>
7+
#include <mrfCommonIO.h>
8+
#include <mrfCommon.h>
99
#include <mrfFracSynth.h>
1010

1111
#include "evgMrm.h"
@@ -39,7 +39,7 @@ evgMrm::setRFFreq (epicsFloat64 RFref) {
3939

4040
epicsFloat64
4141
evgMrm::getRFFreq() const {
42-
return m_RFref;
42+
return m_RFref;
4343
}
4444

4545
void
@@ -67,7 +67,7 @@ evgMrm::setFracSynFreq(epicsFloat64 freq) {
6767
epicsUInt32 controlWord = FracSynthControlWord (freq, MRF_FRAC_SYNTH_REF, 0, &error);
6868
if ((!controlWord) || (error > 100.0)) {
6969
char err[80];
70-
sprintf(err, "Cannot set event clock speed to %f MHz.\n", freq);
70+
snprintf(err, sizeof(err), "Cannot set event clock speed to %f MHz.\n", freq);
7171
std::string strErr(err);
7272
throw std::runtime_error(strErr);
7373
}

0 commit comments

Comments
 (0)