[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: storeread segfault...
From: |
Alfred M. Szmidt |
Subject: |
Re: storeread segfault... |
Date: |
Sat, 13 Mar 2004 18:06:50 +0100 (MET) |
storeread segfaults if you don't pass a argument to it.
hurd:/home/ams/hurd/hurd.obj/utils# storeread
Segmentation fault (core dumped)
The following patch fixes that, and it also updates the docstring a
bit. It also makes storeread barf if you pass it >3 arguments
(there is no point in passing more).
That is just bogus, one can do fun stuff like (added extra spaces for
readability):
storeread /dev/hda 1 512 400 1024 600 512
and get several blocks at different addresses.
Here is a new patch, that doesn't screw up the correct behaviour of
storeread; and still fixes the wrong one (segfault when not passing
any arguments to it)
utils/ChangeLog
2004-03-13 Alfred M. Szmidt <ams@kemisten.nu>
* storeread.c (main): Check that we didn't get to few arguments.
--- utils/storeread.c.~1.7.~ 2004-03-14 02:14:27.000000000 -0800
+++ utils/storeread.c 2004-03-14 02:16:05.000000000 -0800
@@ -1,6 +1,6 @@
/* Write portions of a store to stdout
- Copyright (C) 1996,97,99,2001,02,03 Free Software Foundation, Inc.
+ Copyright (C) 1996,97,99,2001,02,03,04 Free Software Foundation, Inc.
Written by Miles Bader <miles@gnu.org>
This file is part of the GNU Hurd.
@@ -109,6 +109,10 @@ main (int argc, char **argv)
break;
case ARGP_KEY_END:
+ if (state->arg_num < 1)
+ /* Not enough arguments. */
+ argp_usage (state);
+
if (addr >= 0)
dump (addr, -1);
else if (! dumped)