diff options
author | kcwu <kcwu@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2005-08-23 11:52:06 +0800 |
---|---|---|
committer | kcwu <kcwu@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2005-08-23 11:52:06 +0800 |
commit | 9ad97ad4b96e2a975f196d19cd43af34cd8beaca (patch) | |
tree | 8d89022be11e10f6e5218ef0b13a665de605b40a /mbbsd/syspost.c | |
parent | 7dfb1cd0396127830a9ba1011f0febf702e61e75 (diff) | |
download | pttbbs-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/syspost.c')
-rw-r--r-- | mbbsd/syspost.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/mbbsd/syspost.c b/mbbsd/syspost.c index 8849b2aa..447e00e3 100644 --- a/mbbsd/syspost.c +++ b/mbbsd/syspost.c @@ -7,12 +7,12 @@ post_msg(const char *bname, const char *title, const char *msg, const char *auth FILE *fp; int bid; fileheader_t fhdr; - char genbuf[256]; + char fname[PATHLEN]; /* 在 bname 板發表新文章 */ - setbpath(genbuf, bname); - stampfile(genbuf, &fhdr); - fp = fopen(genbuf, "w"); + setbpath(fname, bname); + stampfile(fname, &fhdr); + fp = fopen(fname, "w"); if (!fp) return -1; @@ -27,8 +27,8 @@ post_msg(const char *bname, const char *title, const char *msg, const char *auth /* 將檔案加入列表 */ strlcpy(fhdr.title, title, sizeof(fhdr.title)); strlcpy(fhdr.owner, author, sizeof(fhdr.owner)); - setbdir(genbuf, bname); - if (append_record(genbuf, &fhdr, sizeof(fhdr)) != -1) + setbdir(fname, bname); + if (append_record(fname, &fhdr, sizeof(fhdr)) != -1) if ((bid = getbnum(bname)) > 0) setbtotal(bid); return 0; |