From: Günther Deschner Date: Fri, 28 Mar 2008 23:47:42 +0000 (+0100) Subject: Don't let winbind getgroups crash when we have no gids in the token. X-Git-Tag: samba-3.3.0pre1~3015^2~1 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=6a576cfe9b87e69af6acbe9abc04124b8b743fd3;p=thirdparty%2Fsamba.git Don't let winbind getgroups crash when we have no gids in the token. Guenther --- diff --git a/source/winbindd/winbindd_group.c b/source/winbindd/winbindd_group.c index 6a704cf2902..5dbd8c55a5d 100644 --- a/source/winbindd/winbindd_group.c +++ b/source/winbindd/winbindd_group.c @@ -1595,9 +1595,11 @@ static void getgroups_sid2gid_recv(void *private_data, bool success, gid_t gid) } s->state->response.data.num_entries = s->num_token_gids; - /* s->token_gids are talloced */ - s->state->response.extra_data.data = smb_xmemdup(s->token_gids, s->num_token_gids * sizeof(gid_t)); - s->state->response.length += s->num_token_gids * sizeof(gid_t); + if (s->num_token_gids) { + /* s->token_gids are talloced */ + s->state->response.extra_data.data = smb_xmemdup(s->token_gids, s->num_token_gids * sizeof(gid_t)); + s->state->response.length += s->num_token_gids * sizeof(gid_t); + } request_ok(s->state); }