Skip to contentSkip to conversation

Fix for rescue mode crashes

PATCH Timothy Baldwin 3 participants 4 messages May 23, 2004 – May 28, 2004

lore
Share & tools
lore
#0 lore raw

Rescue mode crashes when a null string is entered (only sometimes on bochs). Here is a patch to fix it:

Index: kern/rescue.c
===================================================================
RCS file: /cvsroot/grub/grub2/kern/rescue.c,v
retrieving revision 1.8

rescue.c 21 May 2004 09:28:32 -0000 renamed from rescue.c 4 Apr 2004 13:46:02 -0000 1.8 +1 -2
diff -u -r1.8 rescue.c
@@ -676,12 +676,12 @@
       /* Get a command line.  */
       grub_rescue_get_command_line ("grub rescue> ");
 
-      if (grub_split_cmdline (line, getline, &n, &args))
+      if (grub_split_cmdline (line, getline, &n, &args) || n < 0)
        continue;
 
 
-- 

Member AFFS, WYLUG, SWP (UK), ANL, RESPECT, Leeds SA, Leeds Anti-war coalition
No to software patents! No to DRM/EUCD - hands off our computers!

#1 lore raw
Quoted 2 lines · Timothy Baldwin

Rescue mode crashes when a null string is entered (only sometimes on bochs). Here is a patch to fix it:

Nice catch. Thanks a lot for fixing this. If it is ok for Okuji I will put this in.

Can you please write a changelog entry the next time you write a patch? You can find in the GNU Coding Standards how to do this:

http://www.gnu.org/prep/standards_40.html#SEC40

Thanks,
Marco

#2 lore raw
Quoted 2 lines · Marco Gerards

Nice catch. Thanks a lot for fixing this. If it is ok for Okuji I will put this in.

No problem...

Thanks,
Okuji

#3 lore raw
In reply to Timothy Baldwin

rescue.c 21 May 2004 09:28:32 -0000 line 679

Quoted 2 lines · Timothy Baldwin
rescue.c 21 May 2004 09:28:32 -0000 renamed from rescue.c 4 Apr 2004 13:46:02 -0000 1.8 +1 -1
-      if (grub_split_cmdline (line, getline, &n, &args))
+      if (grub_split_cmdline (line, getline, &n, &args) || n < 0)

Now I think about it, it is better to fix this in grub_split_cmdline. That would be a cleaner solution and that will fix the same problem in normal mode as well (I assume it has the same problems).

I will fix this and commit it this evening.

Thanks,
Marco