Fixing STRING_OVERFLOW defect reported by Coverity
authorivana <ivana@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 28 Sep 2010 11:35:40 +0000 (11:35 +0000)
committerivana <ivana@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 28 Sep 2010 11:35:40 +0000 (11:35 +0000)
MUON/AliMUONLocalTriggerBoard.cxx
MUON/AliMUONRawWriter.cxx

index 94beda2..48b7410 100644 (file)
@@ -514,6 +514,11 @@ void AliMUONLocalTriggerBoard::Module(char *mod)
 ///
    const Int_t kMaxfields = 2; char **fields = new char*[kMaxfields];
 
+   if ( fName.Length() > 100 ) {
+     AliErrorStream() << "Name too long: " << GetName() << endl;
+     return;
+   }   
+   
    char s[100]; strcpy(s, GetName());
 
    Int_t numlines = 0;
@@ -1199,6 +1204,11 @@ Int_t AliMUONLocalTriggerBoard::GetI() const
 
    const Int_t kMaxfields = 2; char **fields = new char*[kMaxfields];
 
+   if ( fName.Length() > 100 ) {
+     AliErrorStream() << "Name too long: " << GetName() << endl;
+     return 0;
+   }   
+   
    char s[100]; strcpy(s, GetName());
 
    Int_t numlines = 0;
index f4359bb..3036711 100644 (file)
@@ -164,7 +164,6 @@ Int_t AliMUONRawWriter::Digits2Raw(const AliMUONVDigitStore* digitStore,
   AliCodeTimerAuto("",0)
   
   Int_t idDDL;
-  Char_t name[255];
 
   // tracking chambers
   
@@ -205,12 +204,10 @@ Int_t AliMUONRawWriter::Digits2Raw(const AliMUONVDigitStore* digitStore,
     
     // open files
     idDDL = 0;// MUTR
-    strcpy(name,AliDAQ::DdlFileName("MUONTRG",idDDL));
-    file[0] = new AliFstream(name);
+    file[0] = new AliFstream(AliDAQ::DdlFileName("MUONTRG",idDDL));
     
     idDDL = 1;// MUTR
-    strcpy(name,AliDAQ::DdlFileName("MUONTRG",idDDL));
-    file[1] = new AliFstream(name);
+    file[1] = new AliFstream(AliDAQ::DdlFileName("MUONTRG",idDDL));
       
     WriteTriggerDDL(*triggerStore,file);