Skip to content

Commit

Permalink
Increase some Buffers and Switch to snprintf
Browse files Browse the repository at this point in the history
Increase the buffers to be large enough for a 32bit
integer. And switch to snprintf.
  • Loading branch information
ChristianTackeGSI authored and dennisklein committed Apr 13, 2022
1 parent 9231e8d commit aace6f0
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion examples/simulation/rutherford/src/FairRutherfordGeo.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ const char* FairRutherfordGeo::getModuleName(Int_t m)
ASCII file should start with FairRutherford otherwise they will
not be constructed
*/
sprintf(modName, "rutherford%i", m + 1);
snprintf(modName, sizeof(modName), "rutherford%i", m + 1);
return modName;
}

Expand Down
2 changes: 1 addition & 1 deletion examples/simulation/rutherford/src/FairRutherfordGeo.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class FairRutherfordGeo : public FairGeoSet
{

protected:
char modName[20]; // name of module
char modName[22]; // name of module
char eleName[20]; // substring for elements in module
public:
FairRutherfordGeo();
Expand Down
4 changes: 2 additions & 2 deletions geobase/FairGeoRootBuilder.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,8 @@ Bool_t FairGeoRootBuilder::createNode(FairGeoNode* volu, Int_t hadFormat)
tr = new TGeoTranslation(pos.getX(), pos.getY(), pos.getZ());
} else {
nRot++;
char b[10];
sprintf(b, "R%i", nRot);
char b[13];
snprintf(b, sizeof(b), "R%i", nRot);
TGeoRotation* r = new TGeoRotation(b);
Double_t a[9];
for (Int_t i = 0; i < 9; i++) {
Expand Down

0 comments on commit aace6f0

Please sign in to comment.