* dtable.cc (handle_to_fn): Check error return value from NtQueryObject first

before seeing if name buffer is NULL.
* grp.cc (read_etc_group): Fix gcc warning regarding snprintf format.
* passwd.cc (read_etc_passwd): Ditto.
This commit is contained in:
Christopher Faylor 2002-06-05 15:43:49 +00:00
parent e9259cb240
commit 2bb6b3e506
4 changed files with 18 additions and 6 deletions

View File

@ -1,3 +1,11 @@
2002-06-05 Christopher Faylor <cgf@redhat.com>
* dtable.cc (handle_to_fn): Check error return value from NtQueryObject
first before seeing if name buffer is NULL.
* grp.cc (read_etc_group): Fix gcc warning regarding snprintf format.
* passwd.cc (read_etc_passwd): Ditto.
2002-04-18 Thomas Pfaff <tpfaff@gmx.net> 2002-04-18 Thomas Pfaff <tpfaff@gmx.net>
* thread.h (pthread::joiner): New member. * thread.h (pthread::joiner): New member.

View File

@ -734,15 +734,19 @@ handle_to_fn (HANDLE h, char *posix_fn)
DWORD res = NtQueryObject (h, ObjectNameInformation, ntfn, sizeof (fnbuf), NULL); DWORD res = NtQueryObject (h, ObjectNameInformation, ntfn, sizeof (fnbuf), NULL);
// NT seems to do this on an unopened file
if (!ntfn->Name.Buffer)
return NULL;
if (res) if (res)
{ {
strcpy (posix_fn, "some disk file"); strcpy (posix_fn, "some disk file");
return posix_fn; return posix_fn;
} }
// NT seems to do this on an unopened file
if (!ntfn->Name.Buffer)
{
debug_printf ("nt->Name.Buffer == NULL");
return NULL;
}
ntfn->Name.Buffer[ntfn->Name.Length / sizeof (WCHAR)] = 0; ntfn->Name.Buffer[ntfn->Name.Length / sizeof (WCHAR)] = 0;
char win32_fn[MAX_PATH + 100]; char win32_fn[MAX_PATH + 100];

View File

@ -186,7 +186,7 @@ read_etc_group ()
&domain_name_len, &acType)) &domain_name_len, &acType))
{ {
char strbuf[100]; char strbuf[100];
snprintf (linebuf, sizeof (linebuf), "%s:%s:%u:", snprintf (linebuf, sizeof (linebuf), "%s:%s:%lu:",
group_name, group_name,
tg.string (strbuf), tg.string (strbuf),
*GetSidSubAuthority(tg, *GetSidSubAuthority(tg,

View File

@ -177,7 +177,7 @@ read_etc_passwd ()
{ {
char strbuf[100]; char strbuf[100];
snprintf (linebuf, sizeof (linebuf), snprintf (linebuf, sizeof (linebuf),
"%s::%u:%u:%s:%s:/bin/sh", "%s::%lu:%lu:%s:%s:/bin/sh",
cygheap->user.name (), cygheap->user.name (),
*GetSidSubAuthority(tu, *GetSidSubAuthority(tu,
*GetSidSubAuthorityCount(tu) - 1), *GetSidSubAuthorityCount(tu) - 1),