changeset 8378:7d0492aa522d

fix use of uninitialized buffers
author Jaroslav Hajek <highegg@gmail.com>
date Sat, 06 Dec 2008 07:48:35 +0100
parents 25bc2d31e1bf
children ad8ed668e0a4
files src/ChangeLog src/ov-fcn-handle.cc
diffstat 2 files changed, 7 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/ChangeLog	Wed Oct 29 16:52:10 2008 +0100
+++ b/src/ChangeLog	Sat Dec 06 07:48:35 2008 +0100
@@ -1,3 +1,8 @@
+2008-12-06  Jaroslav Hajek  <highegg@gmail.com>
+
+	* ov-fcn-handle.cc (octave_fcn_handle::load_binary): Call istream::get
+	rather than istream::read to supply null terminating character.
+
 2008-10-29  Jaroslav Hajek  <highegg@gmail.com>
 	* file-io.cc, gl-render.cc, load-save.cc, ls-hdf5.cc, ls-mat4.cc,
 	ls-mat5.cc, ls-oct-binary.cc, mex.cc, oct.h, ov-base-int.cc,
--- a/src/ov-fcn-handle.cc	Wed Oct 29 16:52:10 2008 +0100
+++ b/src/ov-fcn-handle.cc	Sat Dec 06 07:48:35 2008 +0100
@@ -474,7 +474,7 @@
     swap_bytes<4> (&tmp);
 
   OCTAVE_LOCAL_BUFFER (char, ctmp1, tmp+1);
-  is.read (ctmp1, tmp);
+  is.get (ctmp1, tmp+1, 0);
   nm = std::string (ctmp1);
 
   if (! is)
@@ -497,7 +497,7 @@
 	swap_bytes<4> (&tmp);
 
       OCTAVE_LOCAL_BUFFER (char, ctmp2, tmp+1);
-      is.read (ctmp2, tmp);
+      is.get (ctmp2, tmp+1, 0);
 
       symbol_table::scope_id local_scope = symbol_table::alloc_scope ();