summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkcwu <kcwu@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2005-02-28 01:33:52 +0800
committerkcwu <kcwu@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2005-02-28 01:33:52 +0800
commitfca296e3aa7cbe20604b475406645d32899921c1 (patch)
tree96bf8d0b1c2f17a8bcb83e8da6b121292bada8ff
parent9ab044ab08421d2ccda42fed75fe55c92a59adf6 (diff)
downloadpttbbs-fca296e3aa7cbe20604b475406645d32899921c1.tar
pttbbs-fca296e3aa7cbe20604b475406645d32899921c1.tar.gz
pttbbs-fca296e3aa7cbe20604b475406645d32899921c1.tar.bz2
pttbbs-fca296e3aa7cbe20604b475406645d32899921c1.tar.lz
pttbbs-fca296e3aa7cbe20604b475406645d32899921c1.tar.xz
pttbbs-fca296e3aa7cbe20604b475406645d32899921c1.tar.zst
pttbbs-fca296e3aa7cbe20604b475406645d32899921c1.zip
don't trust string on shm, to avoid crash
git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@2559 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
-rw-r--r--util/shmctl.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/util/shmctl.c b/util/shmctl.c
index a0a99da3..077566ab 100644
--- a/util/shmctl.c
+++ b/util/shmctl.c
@@ -262,7 +262,7 @@ int utmpfix(int argc, char **argv)
static int
cmputmpuserid(const void * i, const void * j)
{
- return strcasecmp(SHM->uinfo[*(int*)i].userid, SHM->uinfo[*(int*)j].userid);
+ return strncasecmp(SHM->uinfo[*(int*)i].userid, SHM->uinfo[*(int*)j].userid, IDLEN);
}
static int
@@ -280,7 +280,7 @@ cmputmpidle(const void * i, const void * j)
static int
cmputmpfrom(const void * i, const void * j)
{
- return strcmp(SHM->uinfo[*(int*)i].from, SHM->uinfo[*(int*)j].from);
+ return strncmp(SHM->uinfo[*(int*)i].from, SHM->uinfo[*(int*)j].from, sizeof(SHM->uinfo[0].from));
}
static int