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/cache.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/cache.c')
-rw-r--r-- | mbbsd/cache.c | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/mbbsd/cache.c b/mbbsd/cache.c index fd61cf55..0ceb8376 100644 --- a/mbbsd/cache.c +++ b/mbbsd/cache.c @@ -1,4 +1,4 @@ -/* $Id: cache.c,v 1.43 2002/07/21 09:26:02 in2 Exp $ */ +/* $Id: cache.c,v 1.44 2002/07/22 19:02:00 in2 Exp $ */ #include "bbs.h" #ifndef __FreeBSD__ @@ -42,7 +42,7 @@ safe_sleep(unsigned int seconds) static void setapath(char *buf, char *boardname) { - sprintf(buf, "man/boards/%c/%s", boardname[0], boardname); + snprintf(buf, "man/boards/%c/%s", boardname[0], boardname); } static char *str_dotdir = ".DIR"; @@ -329,8 +329,8 @@ setutmpmode(int mode) /* °lÂÜ¨Ï¥ÎªÌ */ if (HAS_PERM(PERM_LOGUSER)) { char msg[200]; - sprintf(msg, "%s setutmpmode to %s(%d) at %s", - cuser.userid, modestring(currutmp, 0), mode, Cdate(&now)); + snprintf(msg, sizeof(msg), "%s setutmpmode to %s(%d) at %s", + cuser.userid, modestring(currutmp, 0), mode, Cdate(&now)); log_user(msg); } } @@ -779,7 +779,8 @@ setbtotal(int bid) char genbuf[256]; int num, fd; - sprintf(genbuf, "boards/%c/%s/.DIR", bh->brdname[0], bh->brdname); + snprintf(genbuf, sizeof(genbuf), + "boards/%c/%s/.DIR", bh->brdname[0], bh->brdname); if ((fd = open(genbuf, O_RDWR)) < 0) return; /* .DIR±¾¤F */ @@ -892,15 +893,16 @@ reload_pttcache() if ((fp = fopen(buf, "r"))) { while (fread(&item, sizeof(item), 1, fp)) { if (item.title[3] == '<' && item.title[8] == '>') { - sprintf(buf, "%s/%s", pbuf, item.filename); + snprintf(buf, sizeof(buf), "%s/%s", pbuf, item.filename); setadir(buf, buf); if (!(fp1 = fopen(buf, "r"))) continue; SHM->next_refresh[section] = SHM->n_notes[section] = id; section++; while (fread(&subitem, sizeof(subitem), 1, fp1)) { - sprintf(buf, "%s/%s/%s", pbuf, item.filename, - subitem.filename); + snprintf(buf, sizeof(buf), + "%s/%s/%s", pbuf, item.filename, + subitem.filename); if (!(fp2 = fopen(buf, "r"))) continue; fread(SHM->notes[id], sizeof(char), 200 * 11, fp2); |