From 656c31920bcccd705d53e15f0184fc0e5e769a6a Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Mon, 3 Jun 2002 17:11:14 +0000 Subject: [PATCH] * syscalls.cc (setegid32): Verify the correctness of the gid of the group returned by getgrgid32. --- winsup/cygwin/ChangeLog | 5 +++++ winsup/cygwin/syscalls.cc | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index adac1b25d..654b16742 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,8 @@ +2002-06-03 Pierre Humblet + + * syscalls.cc (setegid32): Verify the correctness of the gid + of the group returned by getgrgid32. + 2002-06-03 Pierre Humblet * security.cc (lsa2wchar): Suppressed. diff --git a/winsup/cygwin/syscalls.cc b/winsup/cygwin/syscalls.cc index a936a21fd..54418c0a9 100644 --- a/winsup/cygwin/syscalls.cc +++ b/winsup/cygwin/syscalls.cc @@ -2175,7 +2175,8 @@ setegid32 (__gid32_t gid) cygsid gsid; HANDLE ptok; - if (!(gsid.getfromgr (getgrgid32 (gid)))) + struct __group32 * gr = getgrgid32 (gid); + if (!gr || gr->gr_gid != gid || !gsid.getfromgr (gr)) { set_errno (EINVAL); return -1;