summaryrefslogtreecommitdiffstats
path: root/mbbsd
diff options
context:
space:
mode:
authorpiaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2008-04-29 00:51:43 +0800
committerpiaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2008-04-29 00:51:43 +0800
commitccf9231c3989453ff7597049629aba71c513d346 (patch)
treeaed12098a1293e1c3feb5f2aa87cc6b9d2270565 /mbbsd
parent1f16f74c574f6d609dde9b071b0d271069d3dc48 (diff)
downloadpttbbs-ccf9231c3989453ff7597049629aba71c513d346.tar
pttbbs-ccf9231c3989453ff7597049629aba71c513d346.tar.gz
pttbbs-ccf9231c3989453ff7597049629aba71c513d346.tar.bz2
pttbbs-ccf9231c3989453ff7597049629aba71c513d346.tar.lz
pttbbs-ccf9231c3989453ff7597049629aba71c513d346.tar.xz
pttbbs-ccf9231c3989453ff7597049629aba71c513d346.tar.zst
pttbbs-ccf9231c3989453ff7597049629aba71c513d346.zip
- prevent user get BM permission before BMcache ready.
git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@4254 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
Diffstat (limited to 'mbbsd')
-rw-r--r--mbbsd/cache.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/mbbsd/cache.c b/mbbsd/cache.c
index d6fc105d..9cb18c43 100644
--- a/mbbsd/cache.c
+++ b/mbbsd/cache.c
@@ -840,6 +840,14 @@ int is_BM_cache(int bid) /* bid starts from 1 */
{
assert(0<=bid-1 && bid-1<MAX_BOARD);
int *pbm = SHM->BMcache[bid-1];
+ // XXX potential issue:
+ // buildBMcache use -1 as "none".
+ // some function may call is_BM_cache early
+ // without having currutmp->uid (maybe?)
+ // and may get BM permission accidentally.
+ // quick check
+ if (!HasUserPerm(PERM_BASIC) || !currutmp->uid || currutmp->uid == -1)
+ return 0;
// XXX hard coded MAX_BMs=4
if( currutmp->uid == pbm[0] ||
currutmp->uid == pbm[1] ||