]> git.mxchange.org Git - flightgear.git/commitdiff
Patch from Frederic Bouvier:
authordavid <david>
Sun, 2 Mar 2003 16:37:48 +0000 (16:37 +0000)
committerdavid <david>
Sun, 2 Mar 2003 16:37:48 +0000 (16:37 +0000)
arrays of insufficient size are allocated in prop_picker.cxx ( size()
don't count the null char ) and strcpy is writing outside the allocated
array. A patch follow.

src/GUI/prop_picker.cxx

index aed464a4d348a3a40000b04e3f7dc76a23d190bc..445128d34e9d63518d96d53fcb25c93ff6b88eb8 100755 (executable)
@@ -445,11 +445,11 @@ void fgPropPicker::find_props ()
     files = new char* [ num_files+1 ] ;
 
     stdString line = ".";
-    files [ 0 ] = new char[line.size()];
+    files [ 0 ] = new char[line.size() + 1];
     strcpy ( files [ 0 ], line.c_str() );
 
     line = "..";
-    files [ 1 ] = new char[line.size()];
+    files [ 1 ] = new char[line.size() + 1];
     strcpy ( files [ 1 ], line.c_str() );
 
     pi = 2;