summaryrefslogtreecommitdiffstats
path: root/mbbsd/talk.c
diff options
context:
space:
mode:
authorvictor <victor@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2006-01-12 13:00:08 +0800
committervictor <victor@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2006-01-12 13:00:08 +0800
commit927c9665ce01fdade6a0846ad60a561320272440 (patch)
treee84f4cb1a3aa4403408b96fd9aa4ecf6db84eab5 /mbbsd/talk.c
parent395dca515d5b5e9b6d5d3666b96b7fc573e12bc2 (diff)
downloadpttbbs-927c9665ce01fdade6a0846ad60a561320272440.tar
pttbbs-927c9665ce01fdade6a0846ad60a561320272440.tar.gz
pttbbs-927c9665ce01fdade6a0846ad60a561320272440.tar.bz2
pttbbs-927c9665ce01fdade6a0846ad60a561320272440.tar.lz
pttbbs-927c9665ce01fdade6a0846ad60a561320272440.tar.xz
pttbbs-927c9665ce01fdade6a0846ad60a561320272440.tar.zst
pttbbs-927c9665ce01fdade6a0846ad60a561320272440.zip
replace some strncpy with strlcpy, or just strcpy if src is const
git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@3267 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
Diffstat (limited to 'mbbsd/talk.c')
-rw-r--r--mbbsd/talk.c15
1 files changed, 6 insertions, 9 deletions
diff --git a/mbbsd/talk.c b/mbbsd/talk.c
index 15165c07..2ed398a6 100644
--- a/mbbsd/talk.c
+++ b/mbbsd/talk.c
@@ -638,7 +638,7 @@ my_write2(void)
break;
if (my_write(tw->pid, msg, tw->userid, i, tw->uin))
- strncpy(tw->msg[5].last_call_in, t_last_write,
+ strlcpy(tw->msg[5].last_call_in, t_last_write,
sizeof(tw->msg[5].last_call_in));
break;
}
@@ -1205,14 +1205,12 @@ do_talk_char(talkwin_t * twin, int ch, FILE *flog)
case Ctrl('M'):
case Ctrl('J'):
line = big_picture + twin->curln;
- strncpy(buf, (char *)line->data, line->len);
- buf[line->len] = 0;
+ strlcpy(buf, (char *)line->data, line->len + 1);
do_talk_nextline(twin);
break;
case Ctrl('P'):
line = big_picture + twin->curln;
- strncpy(buf, (char *)line->data, line->len);
- buf[line->len] = 0;
+ strlcpy(buf, (char *)line->data, line->len + 1);
if (twin->curln > twin->sline) {
--(twin->curln);
move(twin->curln, twin->curcol);
@@ -1226,8 +1224,7 @@ do_talk_char(talkwin_t * twin, int ch, FILE *flog)
break;
case Ctrl('N'):
line = big_picture + twin->curln;
- strncpy(buf, (char *)line->data, line->len);
- buf[line->len] = 0;
+ strlcpy(buf, (char *)line->data, line->len + 1);
if (twin->curln < twin->eline) {
++(twin->curln);
move(twin->curln, twin->curcol);
@@ -2416,7 +2413,7 @@ userlist(void)
snprintf(buf, sizeof(buf), "¬G¶m [%s]¡G", currutmp->from);
if (!getdata(1, 0, buf, currutmp->from,
sizeof(currutmp->from), DOECHO))
- strncpy(currutmp->from, buf, 23);
+ strlcpy(currutmp->from, buf, sizeof(currutmp->from));
redrawall = redraw = 1;
}
break;
@@ -2608,7 +2605,7 @@ userlist(void)
}
msg.pid = currpid;
- strncpy(msg.userid, cuser.userid, sizeof(msg.userid));
+ strlcpy(msg.userid, cuser.userid, sizeof(msg.userid));
snprintf(msg.last_call_in, sizeof(msg.last_call_in),
"[¼s¼½]%s", genbuf);
for (i = 0; i < SHM->UTMPnumber; ++i) {