From 8cd8e7d3ae07aa772f0d8c09df7ee10290259c65 Mon Sep 17 00:00:00 2001 From: Dwedit Date: Mon, 28 May 2018 10:54:25 -0500 Subject: [PATCH 1/2] Fix a calloc(0) which led to uninitialized data being used later on. --- tasks/task_content.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tasks/task_content.c b/tasks/task_content.c index 3676308d73..a3fdbefc41 100644 --- a/tasks/task_content.c +++ b/tasks/task_content.c @@ -796,8 +796,11 @@ static bool content_file_init( !content_file_init_set_attribs(content, special, content_ctx, error_string)) return false; - info = (struct retro_game_info*) - calloc(content->size, sizeof(*info)); + if (content->size > 0) + { + info = (struct retro_game_info*) + calloc(content->size, sizeof(*info)); + } if (info) { From 51f77464073a4e08c6d7e0e2275a74d18f08260a Mon Sep 17 00:00:00 2001 From: Dwedit Date: Mon, 28 May 2018 10:58:04 -0500 Subject: [PATCH 2/2] reformat like the old code --- tasks/task_content.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/tasks/task_content.c b/tasks/task_content.c index a3fdbefc41..cb3e318b0f 100644 --- a/tasks/task_content.c +++ b/tasks/task_content.c @@ -797,10 +797,8 @@ static bool content_file_init( return false; if (content->size > 0) - { - info = (struct retro_game_info*) + info = (struct retro_game_info*) calloc(content->size, sizeof(*info)); - } if (info) {