summaryrefslogtreecommitdiffstats
path: root/mbbsd/edit.c
diff options
context:
space:
mode:
authorin2 <in2@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2002-07-21 16:18:42 +0800
committerin2 <in2@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2002-07-21 16:18:42 +0800
commit1428a82d1644166fdaa5285c67f236ac02687818 (patch)
tree276d0104ebeaef1c5ce7ab7cf8484a685669a15d /mbbsd/edit.c
parent913a0db139ff6f56e26d1199e7f5ad1c6239c5ea (diff)
downloadpttbbs-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/edit.c')
-rw-r--r--mbbsd/edit.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/mbbsd/edit.c b/mbbsd/edit.c
index c210ba8f..d7680380 100644
--- a/mbbsd/edit.c
+++ b/mbbsd/edit.c
@@ -1,4 +1,4 @@
-/* $Id: edit.c,v 1.12 2002/07/05 17:10:27 in2 Exp $ */
+/* $Id: edit.c,v 1.13 2002/07/21 08:18:41 in2 Exp $ */
#include "bbs.h"
typedef struct textline_t {
struct textline_t *prev;
@@ -767,7 +767,7 @@ write_header(FILE * fp)
int number; /* post number */
} postlog;
- strcpy(postlog.author, cuser.userid);
+ strlcpy(postlog.author, cuser.userid, sizeof(postlog.author));
ifuseanony = 0;
#ifdef HAVE_ANONYMOUS
if (currbrdattr & BRD_ANONYMOUS) {
@@ -779,8 +779,8 @@ write_header(FILE * fp)
getdata(3, 0, "請輸入你想用的ID,也可直接按[Enter]使用原ID:",
real_name, sizeof(real_name), DOECHO);
if (!real_name[0] && defanony) {
- strcpy(real_name, "Anonymous");
- strcpy(postlog.author, real_name);
+ strlcpy(real_name, "Anonymous", sizeof(real_name));
+ strlcpy(postlog.author, real_name, sizeof(postlog.author));
ifuseanony = 1;
} else {
if (!strcmp("r", real_name) || (!defanony && !real_name[0]))
@@ -792,7 +792,7 @@ write_header(FILE * fp)
}
}
#endif
- strcpy(postlog.board, currboard);
+ strlcpy(postlog.board, currboard, sizeof(postlog.board));
ptr = save_title;
if (!strncmp(ptr, str_reply, 4))
ptr += 4;
@@ -929,9 +929,9 @@ write_file(char *fpath, int saveheader, int *islocal)
case 't':
move(3, 0);
prints("舊標題:%s", save_title);
- strcpy(ans, save_title);
+ strlcpy(ans, save_title, sizeof(ans));
if (getdata_buf(4, 0, "新標題:", ans, sizeof(ans), DOECHO))
- strcpy(save_title, ans);
+ strlcpy(save_title, ans, sizeof(save_title));
return KEEP_EDITING;
case 's':
if (!HAS_PERM(PERM_LOGINOK)) {
@@ -1429,10 +1429,10 @@ block_del(int hide)
char buf[WRAPMARGIN + 2];
if (currpnt > blockpnt) {
- strcpy(buf, begin->data + blockpnt);
+ strlcpy(buf, begin->data + blockpnt, sizeof(buf));
buf[currpnt - blockpnt] = 0;
} else {
- strcpy(buf, begin->data + currpnt);
+ strlcpy(buf, begin->data + currpnt, sizeof(buf));
buf[blockpnt - currpnt] = 0;
}
fputs(buf, fp);
@@ -1454,7 +1454,7 @@ block_del(int hide)
min = currpnt;
max = blockpnt;
}
- strcpy(begin->data + min, begin->data + max);
+ strlcpy(begin->data + min, begin->data + max, sizeof(begin->data) - min);
begin->len -= max - min;
currpnt = min;
} else {
@@ -1780,7 +1780,7 @@ vedit(char *fpath, int saveheader, int *islocal)
char *tmp, *apos = ans;
int fg, bg;
- strcpy(color, "\033[");
+ strlcpy(color, "\033[", sizeof(color));
if (isdigit(*apos)) {
sprintf(color, "%s%c", color, *(apos++));
if (*apos)
@@ -1933,7 +1933,7 @@ vedit(char *fpath, int saveheader, int *islocal)
if (strcmp(line, currline->data)) {
char buf[WRAPMARGIN];
- strcpy(buf, currline->data);
+ strlcpy(buf, currline->data, sizeof(buf));
strcpy(currline->data, line);
strcpy(line, buf);
currline->len = strlen(currline->data);