diff options
author | victor <victor@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2003-09-10 15:15:02 +0800 |
---|---|---|
committer | victor <victor@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2003-09-10 15:15:02 +0800 |
commit | cf8c6166f982e9124e00403254f8152b3790f755 (patch) | |
tree | 338337b76fd9c2cb9d9356782602079744d42af5 /mbbsd | |
parent | fd0bebe7a68f0ff2a4a3a3aa90fc81bc28ee3e66 (diff) | |
download | pttbbs-cf8c6166f982e9124e00403254f8152b3790f755.tar pttbbs-cf8c6166f982e9124e00403254f8152b3790f755.tar.gz pttbbs-cf8c6166f982e9124e00403254f8152b3790f755.tar.bz2 pttbbs-cf8c6166f982e9124e00403254f8152b3790f755.tar.lz pttbbs-cf8c6166f982e9124e00403254f8152b3790f755.tar.xz pttbbs-cf8c6166f982e9124e00403254f8152b3790f755.tar.zst pttbbs-cf8c6166f982e9124e00403254f8152b3790f755.zip |
fix the bug with wrong length of fromhost
git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@1173 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
Diffstat (limited to 'mbbsd')
-rw-r--r-- | mbbsd/mbbsd.c | 8 |
1 files changed, 4 insertions, 4 deletions
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(); |