[bug/patch] one_argument

From: George (greerga@DRAGON.HAM.MUOHIO.EDU)
Date: 10/17/97


one_argument() does not handle a NULL string correctly.

char *one_argument(char *argument, char *first_arg)
{
  char *begin = first_arg;

  do {
    skip_spaces(&argument);     <- bombs here

Here is a small patch to fix this:

diff -upPr -x *.o ../stk/interpreter.c ./interpreter.c
--- ../stk/interpreter.c        Fri Apr 12 23:39:21 1996
+++ ./interpreter.c     Fri Oct 17 19:36:35 1997
@@ -903,6 +903,12 @@ char *one_argument(char *argument, char
 {
   char *begin = first_arg;

+  if (!argument) {
+    log("SYSERR: one_argument received a NULL pointer.");
+    *first_arg = '\0';
+    return NULL;
+  }
+
   do {
     skip_spaces(&argument);


Though you shouldn't be giving it a NULL string in the first place... :)

Other new patches:
         2. Writable Strings Patch - stock? (45,355 bytes)
         3. Road Sector Patch - Stock? (923 bytes)
         4. csh ! Stock Patch - how Jeremy wants it. (2,964 bytes)
         5. Sector Stock Patch - Informative (904 bytes)
         6. dummy_mob Stock Patch - TODO done. (658 bytes)

--
George Greer  -  Me@Null.net   | Genius may have its limitations, but stupidity
http://www.van.ml.org/~greerga | is not thus handicapped. -- Elbert Hubbard


     +------------------------------------------------------------+
     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     | http://democracy.queensu.ca/~fletcher/Circle/list-faq.html |
     +------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 12/08/00 PST