summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Georgi <patrick@georgi-clan.de>2014-08-09 17:12:23 +0200
committerPatrick Georgi <patrick@georgi-clan.de>2014-08-10 18:50:30 +0200
commit802ad521804b8a9f473780fdff4058dd3f8520c3 (patch)
treeaca769a833479c707d5e8a078c8dd17994a605e5
parenta438049422fae85fe4df3ab3f89dbca797d6f5a9 (diff)
downloadcoreboot-802ad521804b8a9f473780fdff4058dd3f8520c3.tar.xz
ifdtool: Provide bounds on string parser
While the result will not be pretty (ie. ifdtool will mis-parse string components longer than 255 characters), at least it doesn't overflow stack variables anymore. Change-Id: I263c5cf823a2d8a863dcece7c4ee0b26475f9fc4 Found-by: Coverity Scan Signed-off-by: Patrick Georgi <patrick@georgi-clan.de> Reviewed-on: http://review.coreboot.org/6562 Reviewed-by: Edward O'Callaghan <eocallaghan@alterapraxis.com> Tested-by: build bot (Jenkins)
-rw-r--r--util/ifdtool/ifdtool.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/util/ifdtool/ifdtool.c b/util/ifdtool/ifdtool.c
index c4785504d5..625d650a5e 100644
--- a/util/ifdtool/ifdtool.c
+++ b/util/ifdtool/ifdtool.c
@@ -761,7 +761,7 @@ void new_layout(char *filename, char *image, int size, char *layout_fname)
while (!feof(romlayout)) {
char *tstr1, *tstr2;
- if (2 != fscanf(romlayout, "%s %s\n", tempstr,
+ if (2 != fscanf(romlayout, "%255s %255s\n", tempstr,
layout_region_name))
continue;