From dcf937e39f1268ee63aaa766ed87268afb698624 Mon Sep 17 00:00:00 2001 From: curt Date: Sun, 9 Dec 2001 04:29:27 +0000 Subject: [PATCH] From Christian Mayer fixing some array allocation/overrun errors. --- src/GUI/prop_picker.cxx | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/GUI/prop_picker.cxx b/src/GUI/prop_picker.cxx index 1024e617d..a51379460 100755 --- a/src/GUI/prop_picker.cxx +++ b/src/GUI/prop_picker.cxx @@ -447,12 +447,12 @@ void fgPropPicker::find_props () pi = 0; } else { // add two for the .. and . - num_files = num_files +2; + num_files = num_files + 2; // make room for .. and . - files = new char* [ num_files+3 ] ; - names = new char* [ num_files+3 ] ; - values = new char* [ num_files+3 ] ; - dflag = new char [ num_files+3 ] ; + files = new char* [ num_files+1 ] ; + names = new char* [ num_files+1 ] ; + values = new char* [ num_files+1 ] ; + dflag = new char [ num_files+1 ] ; line = "."; files [ 0 ] = new char[ strlen(line.c_str())+2 ]; strcpy ( files [ 0 ], line.c_str() ); @@ -462,7 +462,7 @@ void fgPropPicker::find_props () dflag[ 0 ] = 1; files [ 1 ] = new char[ strlen(line.c_str())+2 ]; strcpy ( files [ 1 ], line.c_str() ); - names [ 1 ] = new char[ 2 ]; + names [ 1 ] = new char[ strlen(line.c_str())+2 ]; values[ 1 ] = new char[ 2 ] ; strcpy ( names [ 1 ], line.c_str() ); @@ -471,7 +471,7 @@ void fgPropPicker::find_props () }; - for (int i = 0; i < (int)node->nChildren()-1; i++) { + for (i = 0; i < (int)node->nChildren()-1; i++) { SGPropertyNode * child = node->getChild(i); name = child->getName(); line = name;