perf-tools/geopm: fix buffer overflow
-From c6d16e060114d2d5136036bd20d179f2626e5ce7 Mon Sep 17 00:00:00 2001
+From c91bdbc540048ee51e20be1fa544569f9c54154e Mon Sep 17 00:00:00 2001
From: "Christopher M. Cantalupo" <christopher.m.cantalupo@intel.com>
Date: Thu, 28 Jun 2018 09:00:11 -0700
Subject: [PATCH] Fix possible C string truncation caught by gcc 8.
+- Fixes #289.
+
Change-Id: I438b82c94e77198721e70f335e1d12b322f24af6
Signed-off-by: Christopher M. Cantalupo <christopher.m.cantalupo@intel.com>
---
src/Exception.cpp | 4 ++--
- src/geopmpolicy_main.c | 18 +++++++++---------
- 2 files changed, 11 insertions(+), 11 deletions(-)
+ src/geopmpolicy_main.c | 20 ++++++++++----------
+ 2 files changed, 12 insertions(+), 12 deletions(-)
diff --git a/src/Exception.cpp b/src/Exception.cpp
index e6a152268..3630bcccf 100644
@@ -33,11 +35,15 @@ index e6a152268..3630bcccf 100644
}
}
diff --git a/src/geopmpolicy_main.c b/src/geopmpolicy_main.c
-index 2acc643fe..30bca89bc 100644
+index 2acc643fe..100094681 100644
--- a/src/geopmpolicy_main.c
+++ b/src/geopmpolicy_main.c
-@@ -73,7 +73,7 @@ int main(int argc, char** argv)
- char file[GEOPMPOLICY_STRING_LENGTH] = {0};
+@@ -70,10 +70,10 @@ int main(int argc, char** argv)
+ int opt = 0;
+ int err = 0;
+ int exec_mode = 0;
+- char file[GEOPMPOLICY_STRING_LENGTH] = {0};
++ char file[2 * GEOPMPOLICY_STRING_LENGTH] = {0};
char mode_string[GEOPMPOLICY_STRING_LENGTH] = {0};
char option_string[GEOPMPOLICY_STRING_LENGTH] = {0};
- char copy_string[GEOPMPOLICY_STRING_LENGTH] = {0};
