libnss fix: allocate a sufficient array for u32s

we did not multiply by the element size before
This commit is contained in:
Motiejus Jakštys 2022-08-09 07:45:09 -07:00
parent 7be5743651
commit b350e8d096

View File

@ -513,7 +513,10 @@ fn initgroups_dyn(
math.min(@intCast(usize, limit), newsize_want); math.min(@intCast(usize, limit), newsize_want);
var buf = groupsp.*[0..oldsize]; var buf = groupsp.*[0..oldsize];
const new_groups = state.initgroups_dyn_allocator.realloc(buf, newsize); const new_groups = state.initgroups_dyn_allocator.realloc(
buf,
newsize * @sizeOf(u32),
);
if (new_groups) |newgroups| { if (new_groups) |newgroups| {
groupsp.* = newgroups.ptr; groupsp.* = newgroups.ptr;