summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpiaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2014-03-25 18:16:38 +0800
committerpiaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2014-03-25 18:16:38 +0800
commit34f3c073d6d3fd4d92b6e5dd3fc766af80400011 (patch)
treef28cefecc01f6a8e65acafbe1fdb18852400d7d2
parente4f9dee49d4c9fa4239a765a548e26ce200c5be6 (diff)
downloadpttbbs-34f3c073d6d3fd4d92b6e5dd3fc766af80400011.tar
pttbbs-34f3c073d6d3fd4d92b6e5dd3fc766af80400011.tar.gz
pttbbs-34f3c073d6d3fd4d92b6e5dd3fc766af80400011.tar.bz2
pttbbs-34f3c073d6d3fd4d92b6e5dd3fc766af80400011.tar.lz
pttbbs-34f3c073d6d3fd4d92b6e5dd3fc766af80400011.tar.xz
pttbbs-34f3c073d6d3fd4d92b6e5dd3fc766af80400011.tar.zst
pttbbs-34f3c073d6d3fd4d92b6e5dd3fc766af80400011.zip
Fix UTMP array size.
git-svn-id: http://opensvn.csie.org/pttbbs/trunk@5961 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
-rw-r--r--pttbbs/util/update_online.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/pttbbs/util/update_online.c b/pttbbs/util/update_online.c
index dfb42568..c974350a 100644
--- a/pttbbs/util/update_online.c
+++ b/pttbbs/util/update_online.c
@@ -7,14 +7,15 @@ static int verbose = 0;
void fastcheck()
{
- int i, sorted[USHM_SIZE], last_uid = -1;
+ int i, total = SHM->UTMPnumber - 1;
+ int sorted[USHM_SIZE], last_uid = -1;
userec_t urec;
userinfo_t u;
assert(sizeof(sorted) == sizeof(**SHM->sorted));
memcpy(sorted, SHM->sorted[SHM->currsorted][7],
sizeof(sorted));
- for (i = 0; i < USHM_SIZE; i++) {
+ for (i = 0; i < total; i++) {
if (sorted[i] < 0 || sorted[i] >= USHM_SIZE)
continue;
memcpy(&u, SHM->uinfo + sorted[i], sizeof(u));