Fixed possible crash in process_commands()
authorAri Johnson <ari@cobramush.org>
Mon, 13 Aug 2007 01:48:19 +0000 (01:48 +0000)
committerAri Johnson <ari@cobramush.org>
Wed, 4 Apr 2007 05:49:46 +0000 (05:49 +0000)
(cherry picked from commit f467ff30ec3f58b40f5a38a234f9ccd2d2f30276)

game/txt/changes/0.72p4
src/bsd.c

index c5cd3ca1783bfee4df946c2f1225f538e0e8231f..8f14d6f09398a51474a9fb6b0c5224ce4cb0052a 100644 (file)
@@ -25,3 +25,4 @@ CobraMUSH Version 0.72p4
     * Typo in Wizard's max and auto power lists on default for the Nuke power. [RLB]
     * Anyone can now set INHERITABLE on himself regardless of having the
       Privilege power [AEJ]
+    * Fixed possible crash in process_commands() [AEJ]
index a1e15f85f29571a61688f8c6c11dcbe40b566c57..54cdf58726f0ab06940bc381cb49ccf75a85079e 100644 (file)
--- a/src/bsd.c
+++ b/src/bsd.c
@@ -5514,25 +5514,24 @@ void feed_snoop(DESC *d, const char *s, char dir) {
   int n;
   char snstr[BUFFER_LEN];
 
-
-  if(!d ||!d->connected)
+  if(!d || !d->connected)
     return;
   memset(snstr, '\0', BUFFER_LEN);
   strncpy(snstr, remove_markup(s, NULL), BUFFER_LEN-1);
   if(*s && !*snstr)
-         return;
-  for(n = 0; n < MAX_SNOOPS ; n++)
-    if(!IsPlayer(d->snooper[n]))
+    return;
+  for(n = 0; n < MAX_SNOOPS ; n++) {
+    if(!GoodObject(d->snooper[n]) || !IsPlayer(d->snooper[n]))
       continue;
-    else if(GoodObject(d->snooper[n]) && IsPlayer(d->snooper[n])) {
-      if(dir == 1) /* player see's */
-        notify_format((dbref) d->snooper[n], T("%s%s<-%s %s"), object_header(d->snooper[n],d->player), ANSI_BLUE,
-           ANSI_NORMAL, snstr);
-      else /* player types */
-       notify_format((dbref) d->snooper[n], T("%s%s->%s %s%s"), object_header(d->snooper[n],d->player), 
-           ANSI_BLUE, ANSI_RED, snstr, ANSI_NORMAL);
-    }
-
+    if(dir == 1) /* player sees */
+      notify_format((dbref) d->snooper[n], T("%s%s<-%s %s"),
+                       object_header(d->snooper[n],d->player),
+                       ANSI_BLUE, ANSI_NORMAL, snstr);
+    else /* player types */
+      notify_format((dbref) d->snooper[n], T("%s%s->%s %s%s"),
+                       object_header(d->snooper[n],d->player),
+                       ANSI_BLUE, ANSI_RED, snstr, ANSI_NORMAL);
+  }
 }
 
 char is_snooped(DESC *d) {