--- source3/passdb/lookup_sid.c.ORIG 2021-01-26 16:25:59.235435000 +0100 +++ source3/passdb/lookup_sid.c 2021-01-26 19:31:37.547397000 +0100 @@ -1247,7 +1247,7 @@ { struct wbcDomainSid *wbc_sids = NULL; struct wbcUnixId *wbc_ids = NULL; - uint32_t i, num_not_cached; + uint32_t i, num_not_cached, num_not_cached_size, cached_not_specified; wbcErr err; bool ret = false; @@ -1257,7 +1257,8 @@ } num_not_cached = 0; - + cached_not_specified = 0; + for (i=0; i 0) + DEBUG(1, ("DANGER, WILL ROBINSON, DANGER! (cached_not_specified=%d, num_not_cached=%d)\n", + cached_not_specified, num_not_cached)); + num_not_cached_size = num_not_cached; wbc_ids = talloc_array(talloc_tos(), struct wbcUnixId, num_not_cached); if (wbc_ids == NULL) { goto fail; @@ -1304,6 +1312,11 @@ for (i=0; i= num_not_cached_size) { + DEBUG(1, ("ERROR - num_not_cached(%d) >= num_not_cached_size(%d), i=%d, num_sids=%d\n", + num_not_cached, num_not_cached_size, i, num_sids)); + goto fail; + } switch (wbc_ids[num_not_cached].type) { case WBC_ID_TYPE_UID: ids[i].type = ID_TYPE_UID;