diff options
author | kcwu <kcwu@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2004-06-10 15:08:55 +0800 |
---|---|---|
committer | kcwu <kcwu@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2004-06-10 15:08:55 +0800 |
commit | 7844305800a7a4781ac46777d429dbe667327911 (patch) | |
tree | 28e429be86f0ecc20cb7d30d95d054b420f09bc9 /mbbsd/friend.c | |
parent | 3b109adbea257408835589c45e0125f77064274c (diff) | |
download | pttbbs-7844305800a7a4781ac46777d429dbe667327911.tar pttbbs-7844305800a7a4781ac46777d429dbe667327911.tar.gz pttbbs-7844305800a7a4781ac46777d429dbe667327911.tar.bz2 pttbbs-7844305800a7a4781ac46777d429dbe667327911.tar.lz pttbbs-7844305800a7a4781ac46777d429dbe667327911.tar.xz pttbbs-7844305800a7a4781ac46777d429dbe667327911.tar.zst pttbbs-7844305800a7a4781ac46777d429dbe667327911.zip |
replace some prints() with outs(),
replace some outs() with outc(),
replace some fprintf() with fputs(),
and so on.
for performance.
and don't treat user input as format string.
git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@2055 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
Diffstat (limited to 'mbbsd/friend.c')
-rw-r--r-- | mbbsd/friend.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/mbbsd/friend.c b/mbbsd/friend.c index 3826e379..d70a33da 100644 --- a/mbbsd/friend.c +++ b/mbbsd/friend.c @@ -423,7 +423,7 @@ friend_edit(int type) } fclose(fp); } - snprintf(genbuf, sizeof(genbuf), "%s", fpath); + strlcpy(genbuf, fpath, sizeof(genbuf)); if ((fp = fopen(genbuf, "r"))) { while (fgets(line, 80, fp)) { sscanf(line, "%s", uident); // XXX check buffer size @@ -443,7 +443,7 @@ friend_edit(int type) getdata_buf(2, 0, " 請為此特別名單取一個簡短名稱:", genbuf, 30, DOECHO); if ((fp = fopen(line, "w"))) { - fprintf(fp, "%s", genbuf); + fputs(genbuf, fp); fclose(fp); } } |