diff options
author | in2 <in2@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2002-07-21 17:33:34 +0800 |
---|---|---|
committer | in2 <in2@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2002-07-21 17:33:34 +0800 |
commit | f9eff7fc2a8b6509b2f7f7b86e895041f96bfdc1 (patch) | |
tree | 26d62c208f12ae59106391d1d391c5d1130ae928 /mbbsd/kaede.c | |
parent | e9a7b75babb76e1a3341161bcb6e80f3753b83c7 (diff) | |
download | pttbbs-f9eff7fc2a8b6509b2f7f7b86e895041f96bfdc1.tar pttbbs-f9eff7fc2a8b6509b2f7f7b86e895041f96bfdc1.tar.gz pttbbs-f9eff7fc2a8b6509b2f7f7b86e895041f96bfdc1.tar.bz2 pttbbs-f9eff7fc2a8b6509b2f7f7b86e895041f96bfdc1.tar.lz pttbbs-f9eff7fc2a8b6509b2f7f7b86e895041f96bfdc1.tar.xz pttbbs-f9eff7fc2a8b6509b2f7f7b86e895041f96bfdc1.tar.zst pttbbs-f9eff7fc2a8b6509b2f7f7b86e895041f96bfdc1.zip |
in Ptt_prints(), sprintf() -> snprintf()
git-svn-id: http://opensvn.csie.org/pttbbs/pttbbs/trunk/pttbbs@430 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
Diffstat (limited to 'mbbsd/kaede.c')
-rw-r--r-- | mbbsd/kaede.c | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/mbbsd/kaede.c b/mbbsd/kaede.c index 252984be..41b927c1 100644 --- a/mbbsd/kaede.c +++ b/mbbsd/kaede.c @@ -1,4 +1,4 @@ -/* $Id: kaede.c,v 1.10 2002/07/21 09:26:02 in2 Exp $ */ +/* $Id: kaede.c,v 1.11 2002/07/21 09:33:34 in2 Exp $ */ #include "bbs.h" char * @@ -8,14 +8,12 @@ Ptt_prints(char *str, int mode) while ((po = strstr(str, "\033*s"))) { po[0] = 0; - sprintf(strbuf, "%s%s%s", str, cuser.userid, po + 3); + snprintf(strbuf, sizeof(strbuf), "%s%s%s", str, cuser.userid, po + 3); strcpy(str, strbuf); } while ((po = strstr(str, "\033*t"))) { - po[0] = 0; - sprintf(strbuf, "%s%s", str, Cdate(&now)); - strcat(strbuf, po + 3); + snprintf(strbuf, sizeof(strbuf), "%s%s%s", str, Cdate(&now), po + 3); strcpy(str, strbuf); } while ((po = strstr(str, "\033*u"))) { @@ -23,32 +21,37 @@ Ptt_prints(char *str, int mode) attempts = SHM->UTMPnumber; po[0] = 0; - sprintf(strbuf, "%s%d%s", str, attempts, po + 3); + snprintf(strbuf, sizeof(strbuf), "%s%d%s", str, attempts, po + 3); strcpy(str, strbuf); } while ((po = strstr(str, "\033*b"))) { po[0] = 0; - sprintf(strbuf, "%s%d/%d%s", str, cuser.month, cuser.day, po + 3); + snprintf(strbuf, sizeof(strbuf), + "%s%d/%d%s", str, cuser.month, cuser.day, po + 3); strcpy(str, strbuf); } while ((po = strstr(str, "\033*l"))) { po[0] = 0; - sprintf(strbuf, "%s%d%s", str, cuser.numlogins, po + 3); + snprintf(strbuf, sizeof(strbuf), + "%s%d%s", str, cuser.numlogins, po + 3); strcpy(str, strbuf); } while ((po = strstr(str, "\033*p"))) { po[0] = 0; - sprintf(strbuf, "%s%d%s", str, cuser.numposts, po + 3); + snprintf(strbuf, sizeof(strbuf), + "%s%d%s", str, cuser.numposts, po + 3); strcpy(str, strbuf); } while ((po = strstr(str, "\033*n"))) { po[0] = 0; - sprintf(strbuf, "%s%s%s", str, cuser.username, po + 3); + snprintf(strbuf, sizeof(strbuf), + "%s%s%s", str, cuser.username, po + 3); strcpy(str, strbuf); } while ((po = strstr(str, "\033*m"))) { po[0] = 0; - sprintf(strbuf, "%s%d%s", str, cuser.money, po + 3); + snprintf(strbuf, sizeof(strbuf), + "%s%d%s", str, cuser.money, po + 3); strcpy(str, strbuf); } strip_ansi(str, str, mode); |