1
0
mirror of https://github.com/samba-team/samba.git synced 2025-02-23 09:57:40 +03:00

libwbclient: Fix wbcListGroups against too small num_entries

Thanks for the s4 winbind sending 0 here and Tridge to point it out to me :-)
This commit is contained in:
Volker Lendecke 2010-04-19 15:50:11 +02:00
parent 6d898b45a3
commit 89bbc41d02

View File

@ -714,8 +714,17 @@ wbcErr wbcListGroups(const char *domain_name,
next = (const char *)response.extra_data.data;
while (next) {
const char *current = next;
char *k = strchr(next, ',');
const char *current;
char *k;
if (num_groups >= response.data.num_entries) {
wbc_status = WBC_ERR_INVALID_RESPONSE;
goto done;
}
current = next;
k = strchr(next, ',');
if (k) {
k[0] = '\0';
next = k+1;
@ -726,10 +735,6 @@ wbcErr wbcListGroups(const char *domain_name,
groups[num_groups] = strdup(current);
BAIL_ON_PTR_ERROR(groups[num_groups], wbc_status);
num_groups += 1;
if (num_groups > response.data.num_entries) {
wbc_status = WBC_ERR_INVALID_RESPONSE;
goto done;
}
}
if (num_groups != response.data.num_entries) {
wbc_status = WBC_ERR_INVALID_RESPONSE;