From f3345cd954974f80862940ec628f17942a288316 Mon Sep 17 00:00:00 2001 From: kcwu Date: Wed, 22 Mar 2006 17:57:26 +0000 Subject: fix bugs introduced because replace sprintf and strncpy with snprintf and strlcpy without careful checks. git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@3292 63ad8ddf-47c3-0310-b6dd-a9e9d9715204 --- mbbsd/osdep.c | 2 +- mbbsd/record.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/mbbsd/osdep.c b/mbbsd/osdep.c index 4872083e..f4a9bd85 100644 --- a/mbbsd/osdep.c +++ b/mbbsd/osdep.c @@ -613,7 +613,7 @@ cpuload(char *str) } if (str) { if (l[0] != -1) - snprintf(str, sizeof(str), " %.2f %.2f %.2f", l[0], l[1], l[2]); + sprintf(str, " %.2f %.2f %.2f", l[0], l[1], l[2]); else strcpy(str, " (unknown) "); } diff --git a/mbbsd/record.c b/mbbsd/record.c index 987b3e3d..79523c69 100644 --- a/mbbsd/record.c +++ b/mbbsd/record.c @@ -574,7 +574,7 @@ append_record_forward(char *fpath, fileheader_t * record, int size, const char * int n; for (n = strlen(fpath) - 1; fpath[n] != '/' && n > 0; n--); - strlcpy(buf, fpath, n + 1); + strncpy(buf, fpath, n + 1); if (n + sizeof(".forward") > sizeof(buf)) return -1; strcpy(buf + n + 1, ".forward"); -- cgit v1.2.3