summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristopher Faylor <me@cgf.cx>2008-05-25 23:51:32 +0000
committerChristopher Faylor <me@cgf.cx>2008-05-25 23:51:32 +0000
commit12cf19762d07e477c5c58419cb522e393bee2e0c (patch)
tree7f18048932dd3456db24830422f104aa5ba13b4a
parentf524521aab47f3bfe51d6e64ea1789166c0940fe (diff)
downloadcygnal-12cf19762d07e477c5c58419cb522e393bee2e0c.tar.gz
cygnal-12cf19762d07e477c5c58419cb522e393bee2e0c.tar.bz2
cygnal-12cf19762d07e477c5c58419cb522e393bee2e0c.zip
* mount.cc (mount_info::from_fstab): Use proper buffer size.
-rw-r--r--winsup/cygwin/ChangeLog4
-rw-r--r--winsup/cygwin/mount.cc7
2 files changed, 7 insertions, 4 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog
index 315cd3a69..e267ea4b5 100644
--- a/winsup/cygwin/ChangeLog
+++ b/winsup/cygwin/ChangeLog
@@ -1,3 +1,7 @@
+2008-05-25 Christopher Faylor <me+cygwin@cgf.cx>
+
+ * mount.cc (mount_info::from_fstab): Use proper buffer size.
+
2008-05-24 Christopher Faylor <me+cygwin@cgf.cx>
* mount.cc (mount_info::init): Revert previous change.
diff --git a/winsup/cygwin/mount.cc b/winsup/cygwin/mount.cc
index 298c00f0a..8aa304ea4 100644
--- a/winsup/cygwin/mount.cc
+++ b/winsup/cygwin/mount.cc
@@ -935,9 +935,8 @@ mount_info::from_fstab (bool user, WCHAR fstab[], PWCHAR fstab_end)
char buf[NT_MAX_PATH];
char *got = buf;
DWORD len = 0;
- /* Using NT_MAX_PATH-1 leaves space to append two \0. */
- while (ReadFile (h, got, (NT_MAX_PATH - 1) * sizeof (WCHAR) - (got - buf),
- &len, NULL))
+ /* Using buffer size - 1 leaves space to append two \0. */
+ while (ReadFile (h, got, (sizeof (buf) - 1) - (got - buf), &len, NULL))
{
char *end;
@@ -954,7 +953,7 @@ mount_info::from_fstab (bool user, WCHAR fstab[], PWCHAR fstab_end)
goto done;
got = end + 1;
}
- if (len < (NT_MAX_PATH - 1) * sizeof (WCHAR))
+ if (len < (sizeof (buf) - 1))
break;
/* We have to read once more. Move remaining bytes to the start of
the buffer and reposition got so that it points to the end of