From db069e27b705f833d4c0bcf096a6550bfe68f6ee Mon Sep 17 00:00:00 2001 From: Rick Bird Date: Fri, 25 Mar 2011 14:08:21 -0400 Subject: [PATCH] PennMUSH Incorporation from 182p2 * Garbled output of locks from examine. Reported by Intrevis. [SW]. * script and compile script updates as well --- hints/irix_6.sh | 1 - src/boolexp.c | 6 ++++++ src/lock.c | 8 ++++++-- utils/mkcmds.sh.SH | 2 +- 4 files changed, 13 insertions(+), 4 deletions(-) diff --git a/hints/irix_6.sh b/hints/irix_6.sh index 091dc15..271f86e 100644 --- a/hints/irix_6.sh +++ b/hints/irix_6.sh @@ -1,4 +1,3 @@ -ccflags="-mabi=n32" loclibpth="/usr/local/lib /usr/gnu/lib /usr/lib32 /usr/lib /lib" libs="-lc -lm" has_sigchld='define' diff --git a/src/boolexp.c b/src/boolexp.c index d099b88..9158f8b 100644 --- a/src/boolexp.c +++ b/src/boolexp.c @@ -778,6 +778,9 @@ safe_boref(dbref player, dbref thing, enum u_b_f flag, char *buff, } } +/** True if unparse_boolexp() is being evaluated. */ +int unparsing_boolexp = 0; + /** Display a boolexp. * This function returns the textual representation of the boolexp. * \param player The object wanting the decompiled boolexp. @@ -792,6 +795,8 @@ unparse_boolexp(dbref player, boolexp b, enum u_b_f flag) char *buftop = boolexp_buf; unsigned char *bytecode = NULL; + unparsing_boolexp = 1; + if (b == TRUE_BOOLEXP) safe_str("*UNLOCKED*", boolexp_buf, &buftop); else { @@ -924,6 +929,7 @@ unparse_boolexp(dbref player, boolexp b, enum u_b_f flag) } done: *buftop++ = '\0'; + unparsing_boolexp = 0; return boolexp_buf; } diff --git a/src/lock.c b/src/lock.c index 20c6a01..1e886c1 100644 --- a/src/lock.c +++ b/src/lock.c @@ -155,6 +155,8 @@ static lock_list *free_list = NULL; static lock_list *next_free_lock(void); static void free_lock(lock_list *ll); +extern int unparsing_boolexp; + /** Return a list of all available locks * \param buff the buffer * \param bp a pointer to the current position in the buffer @@ -800,9 +802,11 @@ int eval_lock(dbref player, dbref thing, lock_type ltype) { boolexp b = getlock(thing, ltype); - log_activity(LA_LOCK, thing, unparse_boolexp(player, b, UB_DBREF)); - if(Pass_Lock(player, thing) && IS_passlock_type(ltype)) + if(Pass_Lock(player, thing) && IS_passlock_type(ltype)) return 1; + /* Prevent overwriting a static buffer in unparse_boolexp() */ + if (!unparsing_boolexp) + log_activity(LA_LOCK, thing, unparse_boolexp(player, b, UB_DBREF)); return eval_boolexp(player, getlock(thing, ltype), thing, NULL); } diff --git a/utils/mkcmds.sh.SH b/utils/mkcmds.sh.SH index b558d1a..f4685ac 100644 --- a/utils/mkcmds.sh.SH +++ b/utils/mkcmds.sh.SH @@ -25,7 +25,7 @@ $spitshell >mkcmds.sh <