summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpiaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2008-05-12 14:39:54 +0800
committerpiaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2008-05-12 14:39:54 +0800
commit14fc5fbbc55fb713299c3e8f5900a2c6141b9b2c (patch)
tree374302bcc43c031a1801c67a2e3221dd2d620028
parent342798eaaaf77f2cea73bd5c36f3a6ce65d9a95a (diff)
downloadpttbbs-14fc5fbbc55fb713299c3e8f5900a2c6141b9b2c.tar
pttbbs-14fc5fbbc55fb713299c3e8f5900a2c6141b9b2c.tar.gz
pttbbs-14fc5fbbc55fb713299c3e8f5900a2c6141b9b2c.tar.bz2
pttbbs-14fc5fbbc55fb713299c3e8f5900a2c6141b9b2c.tar.lz
pttbbs-14fc5fbbc55fb713299c3e8f5900a2c6141b9b2c.tar.xz
pttbbs-14fc5fbbc55fb713299c3e8f5900a2c6141b9b2c.tar.zst
pttbbs-14fc5fbbc55fb713299c3e8f5900a2c6141b9b2c.zip
- mbbsd: clean trailing stuff when fromd is enabled.
git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@4303 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
-rw-r--r--mbbsd/mbbsd.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/mbbsd/mbbsd.c b/mbbsd/mbbsd.c
index 6a5337f5..5c661139 100644
--- a/mbbsd/mbbsd.c
+++ b/mbbsd/mbbsd.c
@@ -1012,9 +1012,13 @@ setup_utmp(int mode)
int fd;
if ( (fd = toconnect(FROMD_ADDR)) >= 0 ) {
write(fd, fromhost, strlen(fromhost));
- // uinfo.from is zerod, so we don't care about read length
- read(fd, currutmp->from, sizeof(currutmp->from) - 1);
+ // zero and reuse uinfo.from to check real data
+ memset(uinfo.from, 0, sizeof(uinfo.from));
+ read(fd, uinfo.from, sizeof(uinfo.from) - 1); // keep trailing zero
close(fd);
+ // copy back to currutmp
+ if (uinfo.from[0])
+ strlcpy(currutmp->from, uinfo.from, sizeof(currutmp->from));
}
}
# else // !FROMD