X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=src%2Fpasswd%2Fgetgrouplist.c;h=301824cec5ac1e973492aa3d252416faa6eb18ac;hb=85050ac5a2677a8ebf2722e93b5c037ec675c036;hp=43e518245f8e6bfdafdbdb2ff5aec92a247798e4;hpb=49d1e7f93129cdcc2ab0cc91832b8a29ccd1570d;p=musl diff --git a/src/passwd/getgrouplist.c b/src/passwd/getgrouplist.c index 43e51824..301824ce 100644 --- a/src/passwd/getgrouplist.c +++ b/src/passwd/getgrouplist.c @@ -31,7 +31,8 @@ int getgrouplist(const char *user, gid_t gid, gid_t *groups, int *ngroups) if (resp[INITGRFOUND]) { nscdbuf = calloc(resp[INITGRNGRPS], sizeof(uint32_t)); if (!nscdbuf) goto cleanup; - if (!fread(nscdbuf, sizeof(*nscdbuf)*resp[INITGRNGRPS], 1, f)) { + size_t nbytes = sizeof(*nscdbuf)*resp[INITGRNGRPS]; + if (nbytes && !fread(nscdbuf, nbytes, 1, f)) { if (!ferror(f)) errno = EIO; goto cleanup; }