Mercurial > hg > octave-lyh
changeset 9430:bfc7b000a229
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 | 4a8d93bafe9c |
children | 78cc9a8fac6d |
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) {