From: Andreas Sandberg <Andreas.Sandberg@ARM.com>
Date: Mon, 7 Jan 2013 21:56:37 +0000 (-0500)
Subject: util: Fix stack corruption in the m5 util
X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=35be32b7ea9748cd061e01d5329e95dfafa4a2e1;p=gem5.git

util: Fix stack corruption in the m5 util

The number of arguments specified when calling parse_int_args() in
do_exit() is incorrect. This leads to stack corruption since it causes
writes past the end of the ints array.
---

diff --git a/util/m5/m5.c b/util/m5/m5.c
index 53ac0fba8..e9fe8f1f3 100644
--- a/util/m5/m5.c
+++ b/util/m5/m5.c
@@ -130,7 +130,7 @@ do_exit(int argc, char *argv[])
         usage();
 
     uint64_t ints[1];
-    parse_int_args(argc, argv, ints, 2);
+    parse_int_args(argc, argv, ints, 1);
     m5_exit(ints[0]);
 }