4
0
mirror of git://sourceware.org/git/newlib-cygwin.git synced 2025-01-18 12:29:32 +08:00

* grp.cc (getgroups): Avoid crash if passwd field if /etc/group is

empty.
This commit is contained in:
Corinna Vinschen 2001-04-18 14:52:07 +00:00
parent 4199e1e6fb
commit 77c45b121e
2 changed files with 7 additions and 1 deletions

View File

@ -1,3 +1,8 @@
2001-04-18 Egor Duda <deo@logos-m.ru>
* grp.cc (getgroups): Avoid crash if passwd field if /etc/group is
empty.
Tue Apr 17 19:05:44 2001 Christopher Faylor <cgf@cygnus.com>
* path.h (path_conv::add_ext_from_sym): Declare.

View File

@ -260,7 +260,8 @@ getgroups (int gidsetsize, gid_t *grouplist, gid_t gid, const char *username)
convert_sid_to_string_sid (groups->Groups[pg].Sid, ssid);
for (int gg = 0; gg < curr_lines; ++gg)
{
if (!strcmp (group_buf[gg].gr_passwd, ssid))
if (group_buf[gg].gr_passwd &&
!strcmp (group_buf[gg].gr_passwd, ssid))
{
if (cnt < gidsetsize)
grouplist[cnt] = group_buf[gg].gr_gid;