From fca296e3aa7cbe20604b475406645d32899921c1 Mon Sep 17 00:00:00 2001 From: kcwu Date: Sun, 27 Feb 2005 17:33:52 +0000 Subject: 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 --- util/shmctl.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'util') 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 -- cgit v1.2.3