summaryrefslogtreecommitdiffstats
path: root/mbbsd/talk.c
diff options
context:
space:
mode:
authorin2 <in2@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2002-05-11 23:30:31 +0800
committerin2 <in2@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2002-05-11 23:30:31 +0800
commit8d3b776476b6446d59e4a36275e924d14371906e (patch)
tree02bdec10af2a962d759c57f56d97a48294a3e0c6 /mbbsd/talk.c
parent2dfc361a325dd07137c7b524f3d472d3d14cda81 (diff)
downloadpttbbs-8d3b776476b6446d59e4a36275e924d14371906e.tar
pttbbs-8d3b776476b6446d59e4a36275e924d14371906e.tar.gz
pttbbs-8d3b776476b6446d59e4a36275e924d14371906e.tar.bz2
pttbbs-8d3b776476b6446d59e4a36275e924d14371906e.tar.lz
pttbbs-8d3b776476b6446d59e4a36275e924d14371906e.tar.xz
pttbbs-8d3b776476b6446d59e4a36275e924d14371906e.tar.zst
pttbbs-8d3b776476b6446d59e4a36275e924d14371906e.zip
avoid infinite loop
git-svn-id: http://opensvn.csie.org/pttbbs/pttbbs/trunk/pttbbs@160 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
Diffstat (limited to 'mbbsd/talk.c')
-rw-r--r--mbbsd/talk.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/mbbsd/talk.c b/mbbsd/talk.c
index 21b60a08..114668c0 100644
--- a/mbbsd/talk.c
+++ b/mbbsd/talk.c
@@ -1,4 +1,4 @@
-/* $Id: talk.c,v 1.29 2002/05/10 12:36:00 lwms Exp $ */
+/* $Id: talk.c,v 1.30 2002/05/11 15:30:31 in2 Exp $ */
#include <stdio.h>
#include <string.h>
#include <errno.h>
@@ -266,7 +266,7 @@ int logout_friend_online(userinfo_t *utmp)
utmp->friend_online[i]=0;
ui = &utmpshm->uinfo[j];
if(ui->pid && ui!=utmp){
- for(k=0; k<ui->friendtotal &&
+ for(k=0; k<ui->friendtotal && k < MAX_FRIEND &&
(int)(ui->friend_online[k] & 0xFFFFFF) !=offset; k++);
if(k<ui->friendtotal){
ui->friendtotal--;
@@ -288,7 +288,7 @@ int friend_stat(userinfo_t *me, userinfo_t * ui)
if (me->brc_id && ui->brc_id == me->brc_id){
hit = IBH;
}
- for(i=0;me->friend_online[i];i++){
+ for(i=0;me->friend_online[i] && i < MAX_FRIEND;i++){
j = (me->friend_online[i] & 0xFFFFFF);
if(ui == &utmpshm->uinfo[j]){
hit |= me->friend_online[i] >>24;