From e5cfb20adbe581943aaafe3313e25fd5eb26277a Mon Sep 17 00:00:00 2001 From: pancake Date: Thu, 20 Apr 2017 16:27:24 +0200 Subject: [PATCH] Fix undefined behaviour in mach0 section --- libr/bin/format/mach0/mach0.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libr/bin/format/mach0/mach0.c b/libr/bin/format/mach0/mach0.c index 398a44b152..ddbcc69a92 100644 --- a/libr/bin/format/mach0/mach0.c +++ b/libr/bin/format/mach0/mach0.c @@ -1321,7 +1321,7 @@ struct section_t* MACH0_(get_sections)(struct MACH0_(obj_t)* bin) { if (to < 1) { return NULL; } - if (!(sections = malloc ((bin->nsects + 1) * sizeof (struct section_t)))) { + if (!(sections = calloc (bin->nsects + 1, sizeof (struct section_t)))) { return NULL; } for (i = 0; i < to; i++) {