From 9bcc244de4b2f07e37025d5180fa37bbe6028fa1 Mon Sep 17 00:00:00 2001
From: Cyrille Bagard <nocbos@gmail.com>
Date: Wed, 2 Jan 2019 21:34:17 +0100
Subject: Avoided playing with fire and local variable addresses.

---
 plugins/ropgadgets/helper.c     | 7 +++++--
 plugins/ropgadgets/helper_arm.c | 7 +++++--
 2 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/plugins/ropgadgets/helper.c b/plugins/ropgadgets/helper.c
index ff89e85..c10af6d 100644
--- a/plugins/ropgadgets/helper.c
+++ b/plugins/ropgadgets/helper.c
@@ -29,6 +29,7 @@
 
 
 #include <i18n.h>
+#include <common/cpp.h>
 
 
 
@@ -101,9 +102,11 @@ const phys_t *setup_instruction_sizes_by_default(size_t *count)
 {
     const phys_t *result;                   /* Liste de taille à renvoyer  */
 
-    result = (phys_t []){ 1 };
+    static const phys_t sizes[] = { 1 };
 
-    *count = 1;
+    result = sizes;
+
+    *count = ARRAY_SIZE(sizes);;
 
     return result;
 
diff --git a/plugins/ropgadgets/helper_arm.c b/plugins/ropgadgets/helper_arm.c
index ae6edf3..e5ea1b0 100644
--- a/plugins/ropgadgets/helper_arm.c
+++ b/plugins/ropgadgets/helper_arm.c
@@ -28,6 +28,7 @@
 #include <malloc.h>
 
 
+#include <common/cpp.h>
 #include <plugins/arm/v7/context.h>
 
 
@@ -118,9 +119,11 @@ const phys_t *setup_instruction_sizes_for_arm(size_t *count)
 {
     const phys_t *result;                   /* Liste de taille à renvoyer  */
 
-    result = (phys_t []){ 2, 4 };
+    static const phys_t arm_sizes[] = { 2, 4 };
 
-    *count = 2;
+    result = arm_sizes;
+
+    *count = ARRAY_SIZE(arm_sizes);;
 
     return result;
 
-- 
cgit v0.11.2-87-g4458