lib: Fix 1415704 CID Integer overflowed argument
authorVolker Lendecke <vl@samba.org>
Thu, 27 Jul 2017 12:09:20 +0000 (14:09 +0200)
committerAndreas Schneider <asn@cryptomilk.org>
Mon, 31 Jul 2017 08:03:27 +0000 (10:03 +0200)
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
lib/uid_wrapper/uid_wrapper.c

index 0d74d203627459c685648ea4a93b303905b8170d..cb31c5e8b009e25812959972f870845e6004019d 100644 (file)
@@ -1035,7 +1035,7 @@ static void uwrap_init_env(struct uwrap_thread *id)
                id->ngroups = 0;
 
                free(id->groups);
                id->ngroups = 0;
 
                free(id->groups);
-               id->groups = malloc(sizeof(gid_t) * ngroups);
+               id->groups = calloc(ngroups, sizeof(gid_t));
                if (id->groups == NULL) {
                        UWRAP_LOG(UWRAP_LOG_ERROR,
                                  "Unable to allocate memory");
                if (id->groups == NULL) {
                        UWRAP_LOG(UWRAP_LOG_ERROR,
                                  "Unable to allocate memory");