OSDN Git Service

* dtable.cc (handle_to_fn): Correct placement and length of name buffer.
authorcgf <cgf>
Wed, 5 Jun 2002 02:42:15 +0000 (02:42 +0000)
committercgf <cgf>
Wed, 5 Jun 2002 02:42:15 +0000 (02:42 +0000)
(Suggested by Pavel Tsekov)

winsup/cygwin/ChangeLog
winsup/cygwin/dtable.cc

index c9ae243..d07cf25 100644 (file)
@@ -1,5 +1,10 @@
 2002-06-04  Christopher Faylor  <cgf@redhat.com>
 
+       * dtable.cc (handle_to_fn): Correct placement and length of name
+       buffer. (Suggested by Pavel Tsekov)
+
+2002-06-04  Christopher Faylor  <cgf@redhat.com>
+
        Remove fcntl.h includes throughout.
        * fhandler.h: Move fcntl.h include here.
        (fhandler_base::set_flags): Accept supplied_bin argument.  Make
index 6c532bc..e2821db 100644 (file)
@@ -726,8 +726,8 @@ handle_to_fn (HANDLE h, char *posix_fn)
 
   memset (fnbuf, 0, sizeof (fnbuf));
   ntfn = (OBJECT_NAME_INFORMATION *) fnbuf;
-  ntfn->Name.MaximumLength = sizeof (fnbuf);
-  ntfn->Name.Buffer = (WCHAR *) ntfn + 1;
+  ntfn->Name.MaximumLength = sizeof (fnbuf) - sizeof (*ntfn);
+  ntfn->Name.Buffer = (WCHAR *) (ntfn + 1);
 
   DWORD res = NtQueryObject (h, ObjectNameInformation, ntfn, sizeof (fnbuf), NULL);