diff options
-rw-r--r-- | winsup/cygwin/ChangeLog | 4 | ||||
-rw-r--r-- | winsup/cygwin/mount.cc | 7 |
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 |