From ef85ce3393756bbec853cfa61938d66259452d2a Mon Sep 17 00:00:00 2001 From: Ari Johnson Date: Mon, 13 Aug 2007 01:48:19 +0000 Subject: [PATCH] Fixed possible crash in process_commands() (cherry picked from commit f467ff30ec3f58b40f5a38a234f9ccd2d2f30276) --- game/txt/changes/0.72p4 | 1 + src/bsd.c | 27 +++++++++++++-------------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/game/txt/changes/0.72p4 b/game/txt/changes/0.72p4 index c5cd3ca..8f14d6f 100644 --- a/game/txt/changes/0.72p4 +++ b/game/txt/changes/0.72p4 @@ -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] diff --git a/src/bsd.c b/src/bsd.c index 5012517..6e03a35 100644 --- 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) { -- 2.30.2