From 77c45b121e815ab2a107f1e3e6f6b737da770d2a Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Wed, 18 Apr 2001 14:52:07 +0000 Subject: * grp.cc (getgroups): Avoid crash if passwd field if /etc/group is empty. --- winsup/cygwin/ChangeLog | 5 +++++ winsup/cygwin/grp.cc | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index bb52a53b6..a60d3361e 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,8 @@ +2001-04-18 Egor Duda + + * grp.cc (getgroups): Avoid crash if passwd field if /etc/group is + empty. + Tue Apr 17 19:05:44 2001 Christopher Faylor * path.h (path_conv::add_ext_from_sym): Declare. diff --git a/winsup/cygwin/grp.cc b/winsup/cygwin/grp.cc index bfea59998..d3431a37f 100644 --- a/winsup/cygwin/grp.cc +++ b/winsup/cygwin/grp.cc @@ -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; -- cgit v1.2.3