From 8268fdb90227af0293d2fbfcf92f971af44cb001 Mon Sep 17 00:00:00 2001 From: Stefan Tauner Date: Mon, 23 Sep 2013 14:21:06 +0000 Subject: layout: Verify layout entries before building a new image using them This fixes a SEGFAULT if a layout entry is included that addresses memory outside the current chip's address range. flashrom will only abort if the offending region(s) is/are included else it will just warn. It will print warnings for regions with negative or zero-length address ranges and bail out after checking all of them. Also, abort for non-write operations if a layout file is given because there is no layout support for other operations yet. Corresponding to flashrom svn r1751. Signed-off-by: Stefan Tauner Acked-by: Carl-Daniel Hailfinger --- cli_classic.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'cli_classic.c') diff --git a/cli_classic.c b/cli_classic.c index 70bccb5..a0c2d64 100644 --- a/cli_classic.c +++ b/cli_classic.c @@ -370,6 +370,12 @@ int main(int argc, char *argv[]) ret = 1; goto out; } + if (layoutfile != NULL && !write_it) { + msg_gerr("Layout files are currently supported for write operations only.\n"); + ret = 1; + goto out; + } + if (process_include_args()) { ret = 1; goto out; -- cgit v1.1