changeset 12040:5a68e3e748c5 release-3-2-x

file-ops.cc (file_ops::symlink, file_ops::readlink): avoid incorrectly sized buffer
author John W. Eaton <jwe@octave.org>
date Sat, 11 Jul 2009 12:46:10 -0400
parents 48d3e2d261e6
children 1d4212b80713
files liboctave/file-ops.cc
diffstat 1 files changed, 2 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/liboctave/file-ops.cc
+++ b/liboctave/file-ops.cc
@@ -210,13 +210,7 @@
 
 #if defined (HAVE_SYMLINK)
 
-  OCTAVE_LOCAL_BUFFER (char, old_nm, old_name.length ());
-  OCTAVE_LOCAL_BUFFER (char, new_nm, new_name.length ());
-
-  strcpy (old_nm, old_name.c_str ());
-  strcpy (new_nm, new_name.c_str ());
-
-  status = ::symlink (old_nm, new_nm);
+  status = ::symlink (old_name.c_str (), new_name.c_str ());
 
   if (status < 0)
     {
@@ -250,11 +244,7 @@
 #if defined (HAVE_READLINK)
   char buf[MAXPATHLEN+1];
 
-  OCTAVE_LOCAL_BUFFER (char, p, path.length ());
-
-  strcpy (p, path.c_str ());
-
-  status = ::readlink (p, buf, MAXPATHLEN);
+  status = ::readlink (path.c_str (), buf, MAXPATHLEN);
 
   if (status < 0)
     {