diff mbox

[5/8] nanddump: check for negative inputs

Message ID 1291017722-23985-5-git-send-email-computersforpeace@gmail.com
State New, archived
Headers show

Commit Message

Brian Norris Nov. 29, 2010, 8:01 a.m. UTC
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
---
 nanddump.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)
diff mbox

Patch

diff --git a/nanddump.c b/nanddump.c
index b0dd7dc..96b46d4 100644
--- a/nanddump.c
+++ b/nanddump.c
@@ -173,6 +173,13 @@  static void process_options(int argc, char * const argv[])
 		}
 	}
 
+	if (start_addr < 0)
+		errmsg_die("Can't specify a negative device offset '%lld'",
+				start_addr);
+
+	if (length < 0)
+		errmsg_die("Can't specify a negative length '%lld'", length);
+
 	if (quiet && pretty_print) {
 		fprintf(stderr, "The quiet and pretty print options are mutually-\n"
 				"exclusive. Choose one or the other.\n");