From 9c6952a563a1d0e506139e22d5abbb281c3c05a1 Mon Sep 17 00:00:00 2001 From: Xuefer Date: Fri, 29 Jun 2007 02:59:36 +0000 Subject: [PATCH] fixed #109: fast inc/dec was trying to break ro protection git-svn-id: svn://svn.lighttpd.net/xcache/branches/1.2@432 c26eb9a1-5813-0410-bd6c-c2e55f420ca7 --- ChangeLog | 1 + xcache.c | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index d231524..c303760 100644 --- a/ChangeLog +++ b/ChangeLog @@ -4,6 +4,7 @@ == ChangeLog == * #86: remove/edit variable in admin page + * fixed #109: fast inc/dec was trying to break ro protection * fixed #101, #105: Fixed compatibility issue for apache 1.x * fixed #94: Garbage collector disabled when xcache.cacher set to off * fixed #92: Zend Optimizer compatibility issue diff --git a/xcache.c b/xcache.c index 328cb40..7d9a99c 100644 --- a/xcache.c +++ b/xcache.c @@ -2001,6 +2001,7 @@ static inline void xc_var_inc_dec(int inc, INTERNAL_FUNCTION_PARAMETERS) /* {{{ /* do it in place */ stored_var = stored_xce->data.var; if (Z_TYPE_P(stored_var->value) == IS_LONG) { + zval *zv; stored_xce->ctime = XG(request_time); stored_xce->ttl = xce.ttl; #ifdef DEBUG @@ -2009,7 +2010,9 @@ static inline void xc_var_inc_dec(int inc, INTERNAL_FUNCTION_PARAMETERS) /* {{{ value = Z_LVAL_P(stored_var->value); value += (inc == 1 ? count : - count); RETVAL_LONG(value); - Z_LVAL_P(stored_var->value) = value; + + zv = (zval *) xce.cache->shm->handlers->to_readwrite(xce.cache->shm, (char *) stored_var->value); + Z_LVAL_P(zv) = value; break; /* leave lock */ } else {