| Summary: | Buffer overflow with long file names in G4eIonisationParameters | ||
|---|---|---|---|
| Product: | Geant4 | Reporter: | azoglauer |
| Component: | processes/electromagnetic/lowenergy | Assignee: | Vladimir.Ivantchenko |
| Status: | RESOLVED FIXED | ||
| Severity: | critical | CC: | azoglauer |
| Priority: | P2 | ||
| Version: | other | ||
| Hardware: | PC | ||
| OS: | Linux | ||
Andreas is absolutly right. Bug is fixed will be in the reference versions Fixed |
This applies to Geant4 release 6.0 and probably all platforms and OSes. In G4eIonisationParameters.cc the following code limits the file length of the G4LEDATA (ionisation part) to 100 characters: l. 188 ff: char nameChar[100] = {""}; std::ostrstream ost(nameChar, 100, std::ios::out); ost << pathString << Z << ".dat"; G4String name(nameChar); I have no idea why the ostrstream has been initialized with a char array. If this is important one should increase the character size to at least 1000: char nameChar[1000] = {""}; std::ostrstream ost(nameChar, 1000, std::ios::out); If there has been no good reason to initialize the ostrstream with an array, a nicer alternative would be: std::ostrstream ost; ost << pathString << Z << ".dat"; G4String name(nameChar); I have tested both version successfully on debian linux. Let me know, when the problem is fixed. Andreas Zoglauer