diff options
author | in2 <in2@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2002-07-23 03:02:01 +0800 |
---|---|---|
committer | in2 <in2@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2002-07-23 03:02:01 +0800 |
commit | 8b45fd166b943e17dabb3f5cdf972baeb58e0346 (patch) | |
tree | 7b2e5bf09b7c9fd812d0ae7cacdfa049c4dc1e07 /mbbsd/syspost.c | |
parent | a1bd04d7decea39d51bbc06b50755976d4184c50 (diff) | |
download | pttbbs-8b45fd166b943e17dabb3f5cdf972baeb58e0346.tar pttbbs-8b45fd166b943e17dabb3f5cdf972baeb58e0346.tar.gz pttbbs-8b45fd166b943e17dabb3f5cdf972baeb58e0346.tar.bz2 pttbbs-8b45fd166b943e17dabb3f5cdf972baeb58e0346.tar.lz pttbbs-8b45fd166b943e17dabb3f5cdf972baeb58e0346.tar.xz pttbbs-8b45fd166b943e17dabb3f5cdf972baeb58e0346.tar.zst pttbbs-8b45fd166b943e17dabb3f5cdf972baeb58e0346.zip |
sprintf() -> snprintf()
git-svn-id: http://opensvn.csie.org/pttbbs/pttbbs/trunk/pttbbs@435 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
Diffstat (limited to 'mbbsd/syspost.c')
-rw-r--r-- | mbbsd/syspost.c | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/mbbsd/syspost.c b/mbbsd/syspost.c index 965ce93b..0a527f22 100644 --- a/mbbsd/syspost.c +++ b/mbbsd/syspost.c @@ -1,4 +1,4 @@ -/* $Id: syspost.c,v 1.14 2002/07/21 09:26:02 in2 Exp $ */ +/* $Id: syspost.c,v 1.15 2002/07/22 19:02:00 in2 Exp $ */ #include "bbs.h" void @@ -36,8 +36,9 @@ post_change_perm(int oldperm, int newperm, char *sysopid, char *userid) cuser.userid, reason); fclose(fp); - sprintf(fhdr.title, "[公安報告] 站長%s修改%s權限報告", - cuser.userid, userid); + snprintf(fhdr.title, sizeof(fhdr.title), + "[公安報告] 站長%s修改%s權限報告", + cuser.userid, userid); strlcpy(fhdr.owner, "[系統安全局]", sizeof(fhdr.owner)); append_record("boards/S/Security/.DIR", &fhdr, sizeof(fhdr)); } @@ -60,7 +61,8 @@ post_violatelaw(char *crime, char *police, char *reason, char *result) "因\033[1;35m%s\033[m行為,\n違反本站站規,處以\033[1;35m%s\033[m,特此公告", crime, ctime(&now), police, crime, reason, result); fclose(fp); - sprintf(fhdr.title, "[報告] %-20s 違法判決報告", crime); + snprintf(fhdr.title, sizeof(fhdr.title), + "[報告] %-20s 違法判決報告", crime); strlcpy(fhdr.owner, "[Ptt法院]", sizeof(fhdr.owner)); append_record("boards/S/Security/.DIR", &fhdr, sizeof(fhdr)); @@ -75,7 +77,8 @@ post_violatelaw(char *crime, char *police, char *reason, char *result) "因\033[1;35m%s\033[m行為,\n違反本站站規,處以\033[1;35m%s\033[m,特此公告", crime, ctime(&now), police, crime, reason, result); fclose(fp); - sprintf(fhdr.title, "[報告] %-20s 違法判決報告", crime); + snprintf(fhdr.title, sizeof(fhdr.title), + "[報告] %-20s 違法判決報告", crime); strlcpy(fhdr.owner, "[Ptt法院]", sizeof(fhdr.owner)); append_record("boards/V/ViolateLaw/.DIR", &fhdr, sizeof(fhdr)); @@ -86,9 +89,10 @@ void post_newboard(char *bgroup, char *bname, char *bms) { char genbuf[256], title[128]; - sprintf(title, "[新板成立] %s", bname); - sprintf(genbuf, "%s 開了一個新板 %s : %s\n\n新任板主為 %s\n\n恭喜*^_^*\n", - cuser.userid, bname, bgroup, bms); + snprintf(title, sizeof(title), "[新板成立] %s", bname); + snprintf(genbuf, sizeof(genbuf), + "%s 開了一個新板 %s : %s\n\n新任板主為 %s\n\n恭喜*^_^*\n", + cuser.userid, bname, bgroup, bms); post_msg("Record", title, genbuf, "[系統]"); } @@ -113,8 +117,8 @@ give_money_post(char *userid, int money) cuser.userid, userid, money); fclose(fp); - sprintf(fhdr.title, "[公安報告] 站長%s使用紅包機報告", - cuser.userid); + snprintf(fhdr.title, sizeof(fhdr.title), "[公安報告] 站長%s使用紅包機報告", + cuser.userid); strlcpy(fhdr.owner, "[系統安全局]", sizeof(fhdr.owner)); append_record("boards/S/Security/.DIR", &fhdr, sizeof(fhdr)); } |