summaryrefslogtreecommitdiffstats
path: root/commands/mem.c
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2012-07-04 23:41:13 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2012-07-05 20:49:02 +0200
commitd22b85a203aea20a2b2618f5f457fe96c502868d (patch)
treee7faa61f905108a9b5dfa8eb8d9da5a408556bbb /commands/mem.c
parentc6e82ee5437618cf09c0955839b4a2b1b167cc4a (diff)
downloadbarebox-d22b85a203aea20a2b2618f5f457fe96c502868d.tar.gz
barebox-d22b85a203aea20a2b2618f5f457fe96c502868d.tar.xz
mem md: bail out without arguments
Without arguments the 'md' command defaults to show address 0 which likely results in a NULL pointer exception, so only three keystrokes are necessary to crash barebox. Show usage instead if 'md' is invoked without arguments, so that it at least requires an address to be given to crash barebox. This increases the stability of barebox by 66%. Hurray! Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'commands/mem.c')
-rw-r--r--commands/mem.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/commands/mem.c b/commands/mem.c
index c1a3a54053..5322def434 100644
--- a/commands/mem.c
+++ b/commands/mem.c
@@ -180,6 +180,8 @@ static int do_mem_md(int argc, char *argv[])
}
if (size == ~0)
size = 0x100;
+ } else {
+ return COMMAND_ERROR_USAGE;
}
fd = open_and_lseek(filename, mode | O_RDONLY, start);