From cf8c6166f982e9124e00403254f8152b3790f755 Mon Sep 17 00:00:00 2001 From: victor Date: Wed, 10 Sep 2003 07:15:02 +0000 Subject: fix the bug with wrong length of fromhost git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@1173 63ad8ddf-47c3-0310-b6dd-a9e9d9715204 --- mbbsd/mbbsd.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'mbbsd') diff --git a/mbbsd/mbbsd.c b/mbbsd/mbbsd.c index 7968860e..f9bc80b3 100644 --- a/mbbsd/mbbsd.c +++ b/mbbsd/mbbsd.c @@ -786,9 +786,9 @@ inline static void birthday_make_a_wish(struct tm *ptime, struct tm *tmp){ } } -inline static void record_lasthost(char *fromhost){ - strncpy(cuser.lasthost, fromhost, sizeof(cuser.lasthost)); - cuser.lasthost[sizeof(cuser.lasthost - 1)] = '\0'; +inline static void record_lasthost(char *fromhost, int len){ + strncpy(cuser.lasthost, fromhost, len); + cuser.lasthost[len - 1] = '\0'; } inline static void check_mailbox_and_read(void){ @@ -916,7 +916,7 @@ user_login() check_bad_login(); check_mailbox_and_read(); check_register(); - record_lasthost(fromhost); + record_lasthost(fromhost, 16); restore_backup(); } else if (!strcmp(cuser.userid, STR_GUEST)) { init_guest_info(); -- cgit v1.2.3