Skip to content

Commit e62e83a

Browse files
ChristianTackeGSIdennisklein
authored andcommitted
Increase some Buffers and Switch to snprintf
Increase the buffers to be large enough for a 32bit integer. And switch to snprintf.
1 parent 906f6e8 commit e62e83a

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

examples/simulation/rutherford/src/FairRutherfordGeo.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ const char* FairRutherfordGeo::getModuleName(Int_t m)
2929
ASCII file should start with FairRutherford otherwise they will
3030
not be constructed
3131
*/
32-
sprintf(modName, "rutherford%i", m + 1);
32+
snprintf(modName, sizeof(modName), "rutherford%i", m + 1);
3333
return modName;
3434
}
3535

examples/simulation/rutherford/src/FairRutherfordGeo.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ class FairRutherfordGeo : public FairGeoSet
1717
{
1818

1919
protected:
20-
char modName[20]; // name of module
20+
char modName[22]; // name of module
2121
char eleName[20]; // substring for elements in module
2222
public:
2323
FairRutherfordGeo();

geobase/FairGeoRootBuilder.cxx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,8 +127,8 @@ Bool_t FairGeoRootBuilder::createNode(FairGeoNode* volu, Int_t hadFormat)
127127
tr = new TGeoTranslation(pos.getX(), pos.getY(), pos.getZ());
128128
} else {
129129
nRot++;
130-
char b[10];
131-
sprintf(b, "R%i", nRot);
130+
char b[13];
131+
snprintf(b, sizeof(b), "R%i", nRot);
132132
TGeoRotation* r = new TGeoRotation(b);
133133
Double_t a[9];
134134
for (Int_t i = 0; i < 9; i++) {

0 commit comments

Comments
 (0)