From 40c45c6ab09e8c888588cd264b11d3c5be97d3e9 Mon Sep 17 00:00:00 2001 From: wens Date: Sun, 22 May 2011 09:17:29 +0000 Subject: Keys with trailing spaces will fail at getbnum() git-svn-id: http://opensvn.csie.org/pttbbs/trunk@5348 63ad8ddf-47c3-0310-b6dd-a9e9d9715204 --- pttbbs/daemon/boardd/boardd.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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)) -- cgit v1.2.3