From feacdd104da0b2493c683c9b0536d957499a480a Mon Sep 17 00:00:00 2001 From: in2 Date: Sun, 30 Jun 2002 18:16:33 +0000 Subject: avoid utmp->friendtotal error git-svn-id: http://opensvn.csie.org/pttbbs/pttbbs/trunk/pttbbs@397 63ad8ddf-47c3-0310-b6dd-a9e9d9715204 --- util/shmctl.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/util/shmctl.c b/util/shmctl.c index 2ce7982b..348b6024 100644 --- a/util/shmctl.c +++ b/util/shmctl.c @@ -1,4 +1,4 @@ -/* $Id: shmctl.c,v 1.22 2002/06/26 01:57:49 in2 Exp $ */ +/* $Id: shmctl.c,v 1.23 2002/06/30 18:16:33 in2 Exp $ */ #include "bbs.h" extern SHM_t *SHM; @@ -9,6 +9,8 @@ int logout_friend_online(userinfo_t *utmp) int offset=(int) (utmp - &SHM->uinfo[0]); userinfo_t *ui; while(utmp->friendtotal){ + if( !(0 <= utmp->friendtotal && utmp->friendtotal < MAX_FRIEND) ) + return 1; i = utmp->friendtotal-1; j = (utmp->friend_online[i] & 0xFFFFFF); if( !(0 <= j && j < MAX_ACTIVE) ) -- cgit v1.2.3