diff options
author | victor <victor@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2006-01-12 13:00:08 +0800 |
---|---|---|
committer | victor <victor@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2006-01-12 13:00:08 +0800 |
commit | 927c9665ce01fdade6a0846ad60a561320272440 (patch) | |
tree | e84f4cb1a3aa4403408b96fd9aa4ecf6db84eab5 /mbbsd/chat.c | |
parent | 395dca515d5b5e9b6d5d3666b96b7fc573e12bc2 (diff) | |
download | pttbbs-927c9665ce01fdade6a0846ad60a561320272440.tar pttbbs-927c9665ce01fdade6a0846ad60a561320272440.tar.gz pttbbs-927c9665ce01fdade6a0846ad60a561320272440.tar.bz2 pttbbs-927c9665ce01fdade6a0846ad60a561320272440.tar.lz pttbbs-927c9665ce01fdade6a0846ad60a561320272440.tar.xz pttbbs-927c9665ce01fdade6a0846ad60a561320272440.tar.zst pttbbs-927c9665ce01fdade6a0846ad60a561320272440.zip |
replace some strncpy with strlcpy, or just strcpy if src is const
git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@3267 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
Diffstat (limited to 'mbbsd/chat.c')
-rw-r--r-- | mbbsd/chat.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/mbbsd/chat.c b/mbbsd/chat.c index fc8507d1..9f468052 100644 --- a/mbbsd/chat.c +++ b/mbbsd/chat.c @@ -66,7 +66,7 @@ struct ChatBuf { }; static int -chat_recv(struct ChatBuf *cb, int fd, char *chatroom, char *chatid) +chat_recv(struct ChatBuf *cb, int fd, char *chatroom, char *chatid, size_t chatid_size) { int c, len; char *bptr; @@ -88,12 +88,12 @@ chat_recv(struct ChatBuf *cb, int fd, char *chatroom, char *chatid) chat_clear(NULL); break; case 'n': - strncpy(chatid, bptr + 2, 8); + strlcpy(chatid, bptr + 2, chatid_size); print_chatid(chatid); clrtoeol(); break; case 'r': - strncpy(chatroom, bptr + 2, IDLEN - 1); + strlcpy(chatroom, bptr + 2, IDLEN); break; case 't': move(0, 0); @@ -449,7 +449,7 @@ t_chat(void) printchatline("¡» ¾´¡I¶l®t¤S¨Ó¤F..."); } if (ch == I_OTHERDATA) {/* incoming */ - if (chat_recv(&chatbuf, cfd, chatroom, chatid) == -1) { + if (chat_recv(&chatbuf, cfd, chatroom, chatid, 9) == -1) { chatting = chat_send(cfd, "/b"); break; } |