summaryrefslogtreecommitdiffstats
path: root/mbbsd/edit.c
diff options
context:
space:
mode:
authorin2 <in2@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2002-07-23 03:02:01 +0800
committerin2 <in2@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2002-07-23 03:02:01 +0800
commit8b45fd166b943e17dabb3f5cdf972baeb58e0346 (patch)
tree7b2e5bf09b7c9fd812d0ae7cacdfa049c4dc1e07 /mbbsd/edit.c
parenta1bd04d7decea39d51bbc06b50755976d4184c50 (diff)
downloadpttbbs-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/edit.c')
-rw-r--r--mbbsd/edit.c21
1 files changed, 12 insertions, 9 deletions
diff --git a/mbbsd/edit.c b/mbbsd/edit.c
index 212f893b..ad210b12 100644
--- a/mbbsd/edit.c
+++ b/mbbsd/edit.c
@@ -1,4 +1,4 @@
-/* $Id: edit.c,v 1.14 2002/07/21 09:26:02 in2 Exp $ */
+/* $Id: edit.c,v 1.15 2002/07/22 19:02:00 in2 Exp $ */
#include "bbs.h"
typedef struct textline_t {
struct textline_t *prev;
@@ -784,9 +784,11 @@ write_header(FILE * fp)
ifuseanony = 1;
} else {
if (!strcmp("r", real_name) || (!defanony && !real_name[0]))
- sprintf(postlog.author, "%s", cuser.userid);
+ snprintf(postlog.author, sizeof(postlog.author),
+ "%s", cuser.userid);
else {
- sprintf(postlog.author, "%s.", real_name);
+ snprintf(postlog.author, sizeof(postlog.author),
+ "%s.", real_name);
ifuseanony = 1;
}
}
@@ -1644,7 +1646,7 @@ vedit(char *fpath, int saveheader, int *islocal)
}
/* 連續240個interval一樣 , 分明是在斂財 */
if (count >= 240) {
- sprintf(buf, "\033[1;33;46m%s\033[37m在\033[37;45m%s"
+ snprintf(buf, sizeof(buf), "\033[1;33;46m%s\033[37m在\033[37;45m%s"
"\033[37m板違法賺錢 , %s\033[m", cuser.userid,
currboard, ctime(&now));
log_file("etc/illegal_money", buf);
@@ -1782,25 +1784,26 @@ vedit(char *fpath, int saveheader, int *islocal)
strlcpy(color, "\033[", sizeof(color));
if (isdigit(*apos)) {
- sprintf(color, "%s%c", color, *(apos++));
+ snprintf(color, sizeof(color),
+ "%s%c", color, *(apos++));
if (*apos)
- sprintf(color, "%s;", color);
+ snprintf(color, sizeof(color), "%s;", color);
}
if (*apos) {
if ((tmp = strchr(t, toupper(*(apos++)))))
fg = tmp - t + 30;
else
fg = 37;
- sprintf(color, "%s%d", color, fg);
+ snprintf(color, sizeof(color), "%s%d", color, fg);
}
if (*apos) {
if ((tmp = strchr(t, toupper(*(apos++)))))
bg = tmp - t + 40;
else
bg = 40;
- sprintf(color, "%s;%d", color, bg);
+ snprintf(color, sizeof(color), "%s;%d", color, bg);
}
- sprintf(color, "%sm", color);
+ snprintf(color, sizeof(color), "%sm", color);
insert_string(color);
} else
insert_string(reset_color);