summaryrefslogtreecommitdiffstats
path: root/mbbsd/chess.c
diff options
context:
space:
mode:
authorkcwu <kcwu@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2005-08-23 11:52:06 +0800
committerkcwu <kcwu@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2005-08-23 11:52:06 +0800
commit9ad97ad4b96e2a975f196d19cd43af34cd8beaca (patch)
tree8d89022be11e10f6e5218ef0b13a665de605b40a /mbbsd/chess.c
parent7dfb1cd0396127830a9ba1011f0febf702e61e75 (diff)
downloadpttbbs-9ad97ad4b96e2a975f196d19cd43af34cd8beaca.tar
pttbbs-9ad97ad4b96e2a975f196d19cd43af34cd8beaca.tar.gz
pttbbs-9ad97ad4b96e2a975f196d19cd43af34cd8beaca.tar.bz2
pttbbs-9ad97ad4b96e2a975f196d19cd43af34cd8beaca.tar.lz
pttbbs-9ad97ad4b96e2a975f196d19cd43af34cd8beaca.tar.xz
pttbbs-9ad97ad4b96e2a975f196d19cd43af34cd8beaca.tar.zst
pttbbs-9ad97ad4b96e2a975f196d19cd43af34cd8beaca.zip
set*() family functions all assume buffer size = PATHLEN, to prevent buffer overflow.
do some s/256/PATHLEN/. git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@3074 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
Diffstat (limited to 'mbbsd/chess.c')
-rw-r--r--mbbsd/chess.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/mbbsd/chess.c b/mbbsd/chess.c
index 7cb9290d..e131459d 100644
--- a/mbbsd/chess.c
+++ b/mbbsd/chess.c
@@ -796,16 +796,16 @@ ChessGenLogGlobal(ChessInfo* info, ChessGameResult result)
{
fileheader_t log_header;
FILE *fp;
- char buf[256];
+ char fname[PATHLEN];
int bid;
if ((bid = getbnum(info->constants->log_board)) == 0)
return;
- setbpath(buf, info->constants->log_board);
- stampfile(buf, &log_header);
+ setbpath(fname, info->constants->log_board);
+ stampfile(fname, &log_header);
- fp = fopen(buf, "w");
+ fp = fopen(fname, "w");
if (fp != NULL) {
info->actions->genlog(info, fp, result);
fclose(fp);
@@ -814,8 +814,8 @@ ChessGenLogGlobal(ChessInfo* info, ChessGameResult result)
snprintf(log_header.title, sizeof(log_header.title), "[´ÑÃÐ] %s VS %s",
info->user1.userid, info->user2.userid);
- setbdir(buf, info->constants->log_board);
- append_record(buf, &log_header, sizeof(log_header));
+ setbdir(fname, info->constants->log_board);
+ append_record(fname, &log_header, sizeof(log_header));
setbtotal(bid);
}
@@ -826,12 +826,12 @@ ChessGenLogUser(ChessInfo* info, ChessGameResult result)
{
fileheader_t log_header;
FILE *fp;
- char buf[256];
+ char fname[PATHLEN];
- sethomepath(buf, cuser.userid);
- stampfile(buf, &log_header);
+ sethomepath(fname, cuser.userid);
+ stampfile(fname, &log_header);
- fp = fopen(buf, "w");
+ fp = fopen(fname, "w");
if (fp != NULL) {
info->actions->genlog(info, fp, result);
fclose(fp);
@@ -846,8 +846,8 @@ ChessGenLogUser(ChessInfo* info, ChessGameResult result)
info->user2.userid, info->user1.userid);
log_header.filemode = 0;
- sethomedir(buf, cuser.userid);
- append_record_forward(buf, &log_header, sizeof(log_header),
+ sethomedir(fname, cuser.userid);
+ append_record_forward(fname, &log_header, sizeof(log_header),
cuser.userid);
mailalert(cuser.userid);