From: Ari Johnson Date: Mon, 13 Aug 2007 01:48:19 +0000 (+0000) Subject: Fixed possible crash in process_commands() X-Git-Tag: 0.72p4~10 X-Git-Url: https://git.theari.com/?a=commitdiff_plain;h=2897979d1d1872fedc7ba1aad7e74480e9e8dcc6;p=cobramush.git Fixed possible crash in process_commands() (cherry picked from commit f467ff30ec3f58b40f5a38a234f9ccd2d2f30276) --- 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 a1e15f8..54cdf58 100644 --- 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) {