diff options
author | in2 <in2@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2002-07-23 03:02:01 +0800 |
---|---|---|
committer | in2 <in2@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2002-07-23 03:02:01 +0800 |
commit | 8b45fd166b943e17dabb3f5cdf972baeb58e0346 (patch) | |
tree | 7b2e5bf09b7c9fd812d0ae7cacdfa049c4dc1e07 /mbbsd/stuff.c | |
parent | a1bd04d7decea39d51bbc06b50755976d4184c50 (diff) | |
download | pttbbs-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/stuff.c')
-rw-r--r-- | mbbsd/stuff.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/mbbsd/stuff.c b/mbbsd/stuff.c index d3297eda..76a3a032 100644 --- a/mbbsd/stuff.c +++ b/mbbsd/stuff.c @@ -1,4 +1,4 @@ -/* $Id: stuff.c,v 1.8 2002/07/21 09:26:02 in2 Exp $ */ +/* $Id: stuff.c,v 1.9 2002/07/22 19:02:00 in2 Exp $ */ #include "bbs.h" /* ----------------------------------------------------- */ @@ -337,19 +337,19 @@ gettime(int line, time_t dt) struct tm *ptime = localtime(&dt), endtime; memcpy(&endtime, ptime, sizeof(struct tm)); - sprintf(yn, "%4d", ptime->tm_year + 1900); + snprintf(yn, sizeof(yn), "%4d", ptime->tm_year + 1900); do { getdata_buf(line, 0, "西元年:", yn, 5, LCECHO); } while ((endtime.tm_year = atoi(yn) - 1900) < 0 || endtime.tm_year > 200); - sprintf(yn, "%d", ptime->tm_mon + 1); + snprintf(yn, sizeof(yn), "%d", ptime->tm_mon + 1); do { getdata_buf(line, 13, "月:", yn, 3, LCECHO); } while ((endtime.tm_mon = atoi(yn) - 1) < 0 || endtime.tm_mon > 11); - sprintf(yn, "%d", ptime->tm_mday); + snprintf(yn, sizeof(yn), "%d", ptime->tm_mday); do { getdata_buf(line, 22, "日:", yn, 3, LCECHO); } while ((endtime.tm_mday = atoi(yn)) < 1 || endtime.tm_mday > 31); - sprintf(yn, "%d", ptime->tm_hour); + snprintf(yn, sizeof(yn), "%d", ptime->tm_hour); do { getdata_buf(line, 31, "時(0-23):", yn, 3, LCECHO); } while ((endtime.tm_hour = atoi(yn)) < 0 || endtime.tm_hour > 23); @@ -434,7 +434,7 @@ vmsg(const char *fmt,...) int ch; va_start(ap, fmt); - vsprintf(msg, fmt, ap); + vsnprintf(msg, sizeof(msg), fmt, ap); va_end(ap); move(b_lines, 0); |