diff options
author | in2 <in2@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2002-07-21 16:18:42 +0800 |
---|---|---|
committer | in2 <in2@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2002-07-21 16:18:42 +0800 |
commit | 1428a82d1644166fdaa5285c67f236ac02687818 (patch) | |
tree | 276d0104ebeaef1c5ce7ab7cf8484a685669a15d /mbbsd/chicken.c | |
parent | 913a0db139ff6f56e26d1199e7f5ad1c6239c5ea (diff) | |
download | pttbbs-1428a82d1644166fdaa5285c67f236ac02687818.tar pttbbs-1428a82d1644166fdaa5285c67f236ac02687818.tar.gz pttbbs-1428a82d1644166fdaa5285c67f236ac02687818.tar.bz2 pttbbs-1428a82d1644166fdaa5285c67f236ac02687818.tar.lz pttbbs-1428a82d1644166fdaa5285c67f236ac02687818.tar.xz pttbbs-1428a82d1644166fdaa5285c67f236ac02687818.tar.zst pttbbs-1428a82d1644166fdaa5285c67f236ac02687818.zip |
strcpy() -> strlcpy()
git-svn-id: http://opensvn.csie.org/pttbbs/pttbbs/trunk/pttbbs@428 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
Diffstat (limited to 'mbbsd/chicken.c')
-rw-r--r-- | mbbsd/chicken.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/mbbsd/chicken.c b/mbbsd/chicken.c index 6b43ee33..f9420a43 100644 --- a/mbbsd/chicken.c +++ b/mbbsd/chicken.c @@ -1,4 +1,4 @@ -/* $Id: chicken.c,v 1.6 2002/07/05 17:10:27 in2 Exp $ */ +/* $Id: chicken.c,v 1.7 2002/07/21 08:18:41 in2 Exp $ */ #include "bbs.h" #define NUM_KINDS 13 /* 有多少種動物 */ @@ -707,7 +707,7 @@ ch_changename() cuser.userid, mychicken->name, chicken_type[(int)mychicken->type], newname, ctime(&now)); - strcpy(mychicken->name, newname); + strlcpy(mychicken->name, newname, sizeof(mychicken->name)); log_file(CHICKENLOG, buf); } } @@ -830,7 +830,7 @@ recover_chicken(chicken_t * thechicken) igetch(); return 0; } - strcpy(thechicken->name, "[撿回來的]"); + strlcpy(thechicken->name, "[撿回來的]", sizeof(thechicken->name)); thechicken->hp = thechicken->hp_max; thechicken->sick = 0; thechicken->satis = 2; @@ -890,7 +890,8 @@ chickenpk(int fd) lockreturn0(CHICKEN, LOCK_MULTI); - strcpy(mateid, currutmp->mateid); /* 把對手的id用local buffer記住 */ + strlcpy(mateid, currutmp->mateid, sizeof(mateid)); + /* 把對手的id用local buffer記住 */ getuser(mateid); memcpy(&ouser, &xuser, sizeof(userec_t)); @@ -990,7 +991,7 @@ chickenpk(int fd) } if (deadtype(ochicken)) { strtok(data, "\n"); - strcpy(buf, data); + strlcpy(buf, data, sizeof(buf)); sprintf(data, "d%s , %s 被 %s 打死了\n", buf + 1, ochicken->name, mychicken->name); } |