summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorvictor <victor@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2003-09-10 15:15:02 +0800
committervictor <victor@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2003-09-10 15:15:02 +0800
commit5e1781467ed54b328322e402a0f59d70c5c0c1e2 (patch)
tree90baa9517f76a12e3e561c8ee15d984febf1eda3
parent159c1882508313f9a740b29a82dbbf0a3df9dc5d (diff)
downloadpttbbs-5e1781467ed54b328322e402a0f59d70c5c0c1e2.tar
pttbbs-5e1781467ed54b328322e402a0f59d70c5c0c1e2.tar.gz
pttbbs-5e1781467ed54b328322e402a0f59d70c5c0c1e2.tar.bz2
pttbbs-5e1781467ed54b328322e402a0f59d70c5c0c1e2.tar.lz
pttbbs-5e1781467ed54b328322e402a0f59d70c5c0c1e2.tar.xz
pttbbs-5e1781467ed54b328322e402a0f59d70c5c0c1e2.tar.zst
pttbbs-5e1781467ed54b328322e402a0f59d70c5c0c1e2.zip
fix the bug with wrong length of fromhost
git-svn-id: http://opensvn.csie.org/pttbbs/trunk@1173 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
-rw-r--r--pttbbs/mbbsd/mbbsd.c8
1 files 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();