summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwens <wens@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2011-05-22 17:17:29 +0800
committerwens <wens@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2011-05-22 17:17:29 +0800
commit40c45c6ab09e8c888588cd264b11d3c5be97d3e9 (patch)
treebe1694d24165523033e02e46001d99b78a38aaa5
parent76a06f5d606b83bd9a91402d7896cbc3c168390c (diff)
downloadpttbbs-40c45c6ab09e8c888588cd264b11d3c5be97d3e9.tar
pttbbs-40c45c6ab09e8c888588cd264b11d3c5be97d3e9.tar.gz
pttbbs-40c45c6ab09e8c888588cd264b11d3c5be97d3e9.tar.bz2
pttbbs-40c45c6ab09e8c888588cd264b11d3c5be97d3e9.tar.lz
pttbbs-40c45c6ab09e8c888588cd264b11d3c5be97d3e9.tar.xz
pttbbs-40c45c6ab09e8c888588cd264b11d3c5be97d3e9.tar.zst
pttbbs-40c45c6ab09e8c888588cd264b11d3c5be97d3e9.zip
Keys with trailing spaces will fail at getbnum()
git-svn-id: http://opensvn.csie.org/pttbbs/trunk@5348 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
-rw-r--r--pttbbs/daemon/boardd/boardd.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/pttbbs/daemon/boardd/boardd.c b/pttbbs/daemon/boardd/boardd.c
index f4efa5bd..b759db10 100644
--- a/pttbbs/daemon/boardd/boardd.c
+++ b/pttbbs/daemon/boardd/boardd.c
@@ -122,7 +122,9 @@ void answer_key(const char *key, int keylen, struct evbuffer *buf)
} else
return;
} else if (strncmp(key, "tobid.", 6) == 0) {
- bid = getbnum(key + 6);
+ char *_key = strndup(key, keylen);
+ bid = getbnum(key);
+ free(_key);
bptr = getbcache(bid);
if (!bptr->brdname[0] || BOARD_HIDDEN(bptr))