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@theari.com>
Thu, 24 Mar 2011 15:58:45 +0000 (15:58 +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 50125175f7970d90cc4f4793d629a133c569e844..6e03a35c81e9059723ab275a621da762f87fd4ab 100644 (file)
--- a/src/bsd.c
+++ b/src/bsd.c
@@ -5422,25 +5422,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) {