diff options
author | Nick Mathewson <nickm@torproject.org> | 2004-10-27 06:25:29 +0000 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2004-10-27 06:25:29 +0000 |
commit | 06fa8fc05fe36d7154e5c321a080607a21690808 (patch) | |
tree | 835cdeb391dfd28b775a79490d1f78677cf82d34 /src/or/rephist.c | |
parent | 4a9c747f6e4bddc7d26e10b8c0a0c510b4e81c47 (diff) | |
download | tor-06fa8fc05fe36d7154e5c321a080607a21690808.tar tor-06fa8fc05fe36d7154e5c321a080607a21690808.tar.gz |
Avoid strcat; use snprintf or strlcat instead
svn:r2605
Diffstat (limited to 'src/or/rephist.c')
-rw-r--r-- | src/or/rephist.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/src/or/rephist.c b/src/or/rephist.c index b87217280..8c6b6cf55 100644 --- a/src/or/rephist.c +++ b/src/or/rephist.c @@ -307,8 +307,7 @@ void write_rep_history(const char *filename) const char *name1; tmpfile = tor_malloc(strlen(filename)+5); - strcpy(tmpfile, filename); - strcat(tmpfile, "_tmp"); + snprintf(tmpfile, strlen(filename)+5, "%s_tmp", filename); f = fopen(tmpfile, "w"); if (!f) goto done; @@ -548,7 +547,7 @@ char *rep_hist_get_bandwidth_lines(void) snprintf(cp, len-(cp-buf), "%d,", b->totals[i]); cp += strlen(cp); } - strcat(cp, "\n"); + strlcat(cp, "\n", len-(cp-buf)); ++cp; } return buf; |