kdb
[Top] [All Lists]

Re: a bug in kdb_parse()

To: Tachino Nobuhiro <tachino@xxxxxxxxxxxxxxxxxxxxx>
Subject: Re: a bug in kdb_parse()
From: Keith Owens <kaos@xxxxxxxxxxxxxxxxx>
Date: Mon, 01 Oct 2001 15:37:45 +1000
Cc: kdb@xxxxxxxxxxx
In-reply-to: Your message of "Mon, 01 Oct 2001 13:52:10 +0900." <k7yg2c91.wl@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>
Sender: owner-kdb@xxxxxxxxxxx
On Mon, 01 Oct 2001 13:52:10 +0900, 
Tachino Nobuhiro <tachino@xxxxxxxxxxxxxxxxxxxxx> wrote:
>I found a bug in kdb_parse() in v1.9 which causes system hang or reboot
>when subcommand like "set LINES=50" is entered.

Thanks for the bug report, I fixed it a different way.

Index: 11-pre1.2/kdb/kdbmain.c
--- 11-pre1.2/kdb/kdbmain.c Thu, 27 Sep 2001 16:49:25 +1000 kaos 
(linux-2.4/b/d/49_kdbmain.c 1.1.1.5.1.2.1.2 644)
+++ 11-pre1.2(w)/kdb/kdbmain.c Mon, 01 Oct 2001 15:36:57 +1000 kaos 
(linux-2.4/b/d/49_kdbmain.c 1.1.1.5.1.2.1.2 644)
@@ -601,9 +601,12 @@ kdb_parse(char *cmdstr, kdb_eframe_t ef)
                        if ((*cp == '\0') || (*cp == '\n'))
                                break;
                        argv[argc++] = cpp;
-                       /* Skip to next whitespace */
-                       while (*cp && !isspace(*cp) && (*cp != '='))
-                               *cpp++ = *cp++;
+                       /* Copy to next whitespace or '=' */
+                       while (*cp && !isspace(*cp)) {
+                               if ((*cpp = *cp++) == '=')
+                                       break;
+                               ++cpp;
+                       }
                        *cpp++ = '\0';  /* Squash a ws or '=' character */
                }
        }


<Prev in Thread] Current Thread [Next in Thread>