a bug in kdb_parse()

Keith Owens kaos at melbourne.sgi.com
Sun Sep 30 22:37:45 PDT 2001


On Mon, 01 Oct 2001 13:52:10 +0900, 
Tachino Nobuhiro <tachino at open.nm.fujitsu.co.jp> 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 */
 		}
 	}




More information about the kdb mailing list