summaryrefslogtreecommitdiffstats
path: root/mbbsd/vote.c
diff options
context:
space:
mode:
authorkcwu <kcwu@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2002-07-22 04:39:34 +0800
committerkcwu <kcwu@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2002-07-22 04:39:34 +0800
commit1357136003927f736b8d3e91c1970d4cc7861977 (patch)
treec3ae703bebaadc6d54926280fa0721718e50703f /mbbsd/vote.c
parent290e94c252bf0d1b384b3775cd9de04f5afa341a (diff)
downloadpttbbs-1357136003927f736b8d3e91c1970d4cc7861977.tar
pttbbs-1357136003927f736b8d3e91c1970d4cc7861977.tar.gz
pttbbs-1357136003927f736b8d3e91c1970d4cc7861977.tar.bz2
pttbbs-1357136003927f736b8d3e91c1970d4cc7861977.tar.lz
pttbbs-1357136003927f736b8d3e91c1970d4cc7861977.tar.xz
pttbbs-1357136003927f736b8d3e91c1970d4cc7861977.tar.zst
pttbbs-1357136003927f736b8d3e91c1970d4cc7861977.zip
check the using of `sizeof' with strlcpy()
git-svn-id: http://opensvn.csie.org/pttbbs/pttbbs/trunk/pttbbs@432 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
Diffstat (limited to 'mbbsd/vote.c')
-rw-r--r--mbbsd/vote.c60
1 files changed, 30 insertions, 30 deletions
diff --git a/mbbsd/vote.c b/mbbsd/vote.c
index f2af6047..29d648a5 100644
--- a/mbbsd/vote.c
+++ b/mbbsd/vote.c
@@ -1,4 +1,4 @@
-/* $Id: vote.c,v 1.12 2002/07/21 09:26:02 in2 Exp $ */
+/* $Id: vote.c,v 1.13 2002/07/21 20:39:34 kcwu Exp $ */
#include "bbs.h"
static int total;
@@ -180,13 +180,13 @@ b_result_one(boardheader_t * fh, int ind)
fh->bvote = 1;
if (ind) {
- sprintf(STR_new_ballots, "%s%d", STR_bv_ballots, ind);
- sprintf(STR_new_control, "%s%d", STR_bv_control, ind);
- sprintf(STR_new_desc, "%s%d", STR_bv_desc, ind);
- sprintf(STR_new_flags, "%s%d", STR_bv_flags, ind);
- sprintf(STR_new_comments, "%s%d", STR_bv_comments, ind);
- sprintf(STR_new_limited, "%s%d", STR_bv_limited, ind);
- sprintf(STR_new_title, "%s%d", STR_bv_title, ind);
+ snprintf(STR_new_ballots, sizeof(STR_new_ballots), "%s%d", STR_bv_ballots, ind);
+ snprintf(STR_new_control, sizeof(STR_new_control),"%s%d", STR_bv_control, ind);
+ snprintf(STR_new_desc, sizeof(STR_new_desc), "%s%d", STR_bv_desc, ind);
+ snprintf(STR_new_flags, sizeof(STR_new_flags), "%s%d", STR_bv_flags, ind);
+ snprintf(STR_new_comments, sizeof(STR_new_comments), "%s%d", STR_bv_comments, ind);
+ snprintf(STR_new_limited, sizeof(STR_new_limited), "%s%d", STR_bv_limited, ind);
+ snprintf(STR_new_title, sizeof(STR_new_title), "%s%d", STR_bv_title, ind);
} else {
strlcpy(STR_new_ballots, STR_bv_ballots, sizeof(STR_new_ballots));
strlcpy(STR_new_control, STR_bv_control, sizeof(STR_new_control));
@@ -287,7 +287,7 @@ b_result(boardheader_t * fh)
for (i = 0; i < 20; i++) {
if (i)
- sprintf(STR_new_control, "%s%d", STR_bv_control, i);
+ sprintf(STR_new_control, sizeof(STR_new_control), "%s%d", STR_bv_control, i);
else
strlcpy(STR_new_control, STR_bv_control, sizeof(STR_new_control));
@@ -367,13 +367,13 @@ vote_view(char *bname, int index)
time_t closetime;
if (index) {
- sprintf(STR_new_ballots, "%s%d", STR_bv_ballots, index);
- sprintf(STR_new_control, "%s%d", STR_bv_control, index);
- sprintf(STR_new_desc, "%s%d", STR_bv_desc, index);
- sprintf(STR_new_flags, "%s%d", STR_bv_flags, index);
- sprintf(STR_new_comments, "%s%d", STR_bv_comments, index);
- sprintf(STR_new_limited, "%s%d", STR_bv_limited, index);
- sprintf(STR_new_title, "%s%d", STR_bv_title, index);
+ sprintf(STR_new_ballots, sizeof(STR_new_ballots),"%s%d", STR_bv_ballots, index);
+ sprintf(STR_new_control, sizeof(STR_new_control), "%s%d", STR_bv_control, index);
+ sprintf(STR_new_desc, sizeof(STR_new_desc), "%s%d", STR_bv_desc, index);
+ sprintf(STR_new_flags, sizeof(STR_new_flags), "%s%d", STR_bv_flags, index);
+ sprintf(STR_new_comments, sizeof(STR_new_comments), "%s%d", STR_bv_comments, index);
+ sprintf(STR_new_limited, sizeof(STR_new_limited), "%s%d", STR_bv_limited, index);
+ sprintf(STR_new_title, sizeof(STR_new_title), "%s%d", STR_bv_title, index);
} else {
strlcpy(STR_new_ballots, STR_bv_ballots, sizeof(STR_new_ballots));
strlcpy(STR_new_control, STR_bv_control, sizeof(STR_new_control));
@@ -618,13 +618,13 @@ vote_maintain(char *bname)
if (x >= 20)
return FULLUPDATE;
if (x) {
- sprintf(STR_new_ballots, "%s%d", STR_bv_ballots, x);
- sprintf(STR_new_control, "%s%d", STR_bv_control, x);
- sprintf(STR_new_desc, "%s%d", STR_bv_desc, x);
- sprintf(STR_new_flags, "%s%d", STR_bv_flags, x);
- sprintf(STR_new_comments, "%s%d", STR_bv_comments, x);
- sprintf(STR_new_limited, "%s%d", STR_bv_limited, x);
- sprintf(STR_new_title, "%s%d", STR_bv_title, x);
+ sprintf(STR_new_ballots, sizeof(STR_new_ballots), "%s%d", STR_bv_ballots, x);
+ sprintf(STR_new_control, sizeof(STR_new_control), "%s%d", STR_bv_control, x);
+ sprintf(STR_new_desc, sizeof(STR_new_desc), "%s%d", STR_bv_desc, x);
+ sprintf(STR_new_flags, sizeof(STR_new_flags), "%s%d", STR_bv_flags, x);
+ sprintf(STR_new_comments, sizeof(STR_new_comments), "%s%d", STR_bv_comments, x);
+ sprintf(STR_new_limited, sizeof(STR_new_limited), "%s%d", STR_bv_limited, x);
+ sprintf(STR_new_title, sizeof(STR_new_title), "%s%d", STR_bv_title, x);
} else {
strlcpy(STR_new_ballots, STR_bv_ballots, sizeof(STR_new_ballots));
strlcpy(STR_new_control, STR_bv_control, sizeof(STR_new_control));
@@ -734,7 +734,7 @@ vote_flag(char *bname, int index, char val)
int fd, num, size;
if (index)
- sprintf(STR_new_flags, "%s%d", STR_bv_flags, index);
+ sprintf(STR_new_flags, sizeof(STR_new_flags), "%s%d", STR_bv_flags, index);
else
strlcpy(STR_new_flags, STR_bv_flags, sizeof(STR_new_flags));
@@ -784,12 +784,12 @@ user_vote_one(char *bname, int ind)
time_t closetime;
if (ind) {
- sprintf(STR_new_ballots, "%s%d", STR_bv_ballots, ind);
- sprintf(STR_new_control, "%s%d", STR_bv_control, ind);
- sprintf(STR_new_desc, "%s%d", STR_bv_desc, ind);
- sprintf(STR_new_flags, "%s%d", STR_bv_flags, ind);
- sprintf(STR_new_comments, "%s%d", STR_bv_comments, ind);
- sprintf(STR_new_limited, "%s%d", STR_bv_limited, ind);
+ sprintf(STR_new_ballots, sizeof(STR_new_ballots), "%s%d", STR_bv_ballots, ind);
+ sprintf(STR_new_control, sizeof(STR_new_control), "%s%d", STR_bv_control, ind);
+ sprintf(STR_new_desc, sizeof(STR_new_desc), "%s%d", STR_bv_desc, ind);
+ sprintf(STR_new_flags, sizeof(STR_new_flags),"%s%d", STR_bv_flags, ind);
+ sprintf(STR_new_comments, sizeof(STR_new_comments), "%s%d", STR_bv_comments, ind);
+ sprintf(STR_new_limited, sizeof(STR_new_limited), "%s%d", STR_bv_limited, ind);
} else {
strlcpy(STR_new_ballots, STR_bv_ballots, sizeof(STR_new_ballots));
strlcpy(STR_new_control, STR_bv_control, sizeof(STR_new_control));