From 5e1781467ed54b328322e402a0f59d70c5c0c1e2 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@1173 63ad8ddf-47c3-0310-b6dd-a9e9d9715204 --- pttbbs/mbbsd/mbbsd.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pttbbs/mbbsd/mbbsd.c b/pttbbs/mbbsd/mbbsd.c index 7968860e..f9bc80b3 100644 --- a/pttbbs/mbbsd/mbbsd.c +++ b/pttbbs/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