From 900efe5ed1d7ea2b50ef22bedab8ec5a4930f0f1 Mon Sep 17 00:00:00 2001
From: Florian Uhlig <f.uhlig@gsi.de>
Date: Wed, 1 Nov 2023 09:17:56 +0100
Subject: [PATCH] Fix crashing test on several Debian based CI runners

The crash happens due to a undersized char array where one writes after the
upper bound when the file path is to long. The problem occurred in the CI
pipeline for some users with very long user names.

The quick fix is to enlarge the charcter arrays but on the long term the char
arrays should be replaced by strings.
---
 macro/geometry/examine_materials.C | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/macro/geometry/examine_materials.C b/macro/geometry/examine_materials.C
index 6b6a09ebff..2e1457fac8 100644
--- a/macro/geometry/examine_materials.C
+++ b/macro/geometry/examine_materials.C
@@ -24,7 +24,7 @@ typedef struct MAT_VOL mat_vol_t;
 
 struct MAT_VOL {
   int count;  // Number of volumes
-  char name[100];
+  char name[200];
 };
 
 int REG_MATERIALS = 0;  // counter for the currently number of registered materials.
@@ -65,7 +65,7 @@ int extract_mat_vol(char* fileName, mat_vol_t* material_array)
 
   file.GetListOfKeys()->Print();
   file.GetSize();
-  char geo_tag[100];
+  char geo_tag[300];
   strcpy(geo_tag, fileName);
   char* ptr = strstr(geo_tag, ".geo.root");
   *(ptr)    = '\0';
@@ -159,7 +159,7 @@ int examine_materials(const char* setup = "sis100_electron")
   printf("\n");
 
   TString fileName;
-  char fileNameC[100];
+  char fileNameC[300];
   CbmSetup* cs                  = run.GetSetup();
   mat_vol_t* detector_materials = (mat_vol_t*) malloc(sizeof(mat_vol_t) * 500);
   for (int i = 0; i < MAX_MATERIALS; i++) {
-- 
GitLab