From: Tilman Sauerbeck Date: Wed, 27 Dec 2017 15:13:46 +0000 (+0100) Subject: Remove multiplication from second argument to Memory_safeMalloc(). X-Git-Url: http://git.code-monkey.de/?p=umurmur.git;a=commitdiff_plain;h=06ded078a1693fb2620b3f1b4eab83e6fbfc37b5 Remove multiplication from second argument to Memory_safeMalloc(). In Msg_banList_create(), transform Memory_safeMalloc(1, sizeof(foo) * many) to Memory_safeMalloc(many, sizeof(foo)) to actually make use of Memory_safeMalloc()'s overflow detection. --- diff --git a/src/messages.c b/src/messages.c index d995485..36bd20c 100644 --- a/src/messages.c +++ b/src/messages.c @@ -384,7 +384,7 @@ message_t *Msg_banList_create(int n_bans) msg->payload.banList = Memory_safeCalloc(1, sizeof(MumbleProto__BanList)); mumble_proto__ban_list__init(msg->payload.banList); msg->payload.banList->n_bans = n_bans; - msg->payload.banList->bans = Memory_safeMalloc(1, sizeof(MumbleProto__BanList__BanEntry *) * n_bans); + msg->payload.banList->bans = Memory_safeMalloc(n_bans, sizeof(MumbleProto__BanList__BanEntry *)); for (i = 0; i < n_bans; i++) { msg->payload.banList->bans[i] = Memory_safeCalloc(1, sizeof(MumbleProto__BanList__BanEntry)); mumble_proto__ban_list__ban_entry__init(msg->payload.banList->bans[i]);