[1180] in Coldmud discussion meeting

root meeting help first previous next last

[COLD] Ignore that last patch, use this one

daemon@ATHENA.MIT.EDU (Sun Dec 15 20:08:35 1996 )

Date: Sun, 15 Dec 1996 17:03:42 -0800 (PST)
From: Brian Buchanan <brian@wasteland.calbbs.com>
To: coldstuff@cold.org

5 seconds after I sent the last patch, Miro noticed another place where 
the string wasn't being NULL-terminated.  Here's the correct patch:

*** string.c.old	Sun Dec 15 16:20:50 1996
--- string.c	Sun Dec 15 17:00:48 1996
***************
*** 289,294 ****
--- 289,295 ----
          /* Move the string's contents into a new string. */
          cnew = string_new(len);
          MEMCPY(cnew->s, str->s + start, (len > str->len) ? str->len : len);
+ 	cnew->s[len]=0;
          cnew->len = len;
          string_discard(str);
          return cnew;
***************
*** 303,308 ****
--- 304,310 ----
          size = len + 1;
  #endif
          str = (cStr *)erealloc(str, sizeof(cStr)+(size * sizeof(char)));
+ 	str->s[start+len]=0;
          str->size = size;
          return str;
      } else {
***************
*** 312,317 ****
--- 314,320 ----
          }
          str->start = start;
          str->len = len;
+ 	str->s[start+len]=0;
          return str;
      }
  }