From 8669c59a17470f93fe87eb0ca96a3c6253c31d5a Mon Sep 17 00:00:00 2001 From: Christopher Faylor Date: Sun, 30 Jun 2013 22:26:41 +0000 Subject: [PATCH] * mount.cc (LFSTAB): Define. (from_fstab): Use LFSTAB constant where appropriate. Properly size path array to include \etc\fstab. Change len argument of mklongpath to reflect the actual size of the destination argument. --- ChangeLog | 7 +++++++ mount.cc | 8 +++++--- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 8913e8ed..c7a11f4d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2013-06-30 Christopher Faylor + + * mount.cc (LFSTAB): Define. + (from_fstab): Use LFSTAB constant where appropriate. Properly size + path array to include \etc\fstab. Change len argument of mklongpath to + reflect the actual size of the destination argument. + 2013-06-29 Christopher Faylor * archive.cc (archive::extract_file): Use named constants for return diff --git a/mount.cc b/mount.cc index f0d9c3aa..0829b97c 100644 --- a/mount.cc +++ b/mount.cc @@ -25,6 +25,7 @@ static const char *cvsid = "\n%%% $Id$\n"; #include "ini.h" #include "win32.h" #include "filemanip.h" +// #include "LogSingleton.h" #include #include @@ -273,15 +274,16 @@ from_fstab_line (mnt *m, char *line) } #define BUFSIZE 65536 +#define LFSTAB L"\\etc\\fstab" static bool from_fstab (mnt *m, const std::string& in_path) { char buf[BUFSIZE]; - WCHAR path[in_path.size () + 7]; + WCHAR path[in_path.size () + sizeof (LFSTAB)]; - mklongpath (path, in_path.c_str (), in_path.size () + 7); - wcscat (path, L"\\etc\\fstab"); + mklongpath (path, in_path.c_str (), sizeof (path) / sizeof (WCHAR)); + wcscat (path, LFSTAB); HANDLE h = CreateFileW (path, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL | FILE_FLAG_BACKUP_SEMANTICS, -- 2.43.5