diff options
author | Nick Mathewson <nickm@torproject.org> | 2012-01-11 14:02:59 -0500 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2012-01-16 15:03:44 -0500 |
commit | 9c29369a04cdf47bd882579331577d82305bf785 (patch) | |
tree | 4a9752c89feb50c9fced1d18fdb4bbf24e3d9b72 /src/or/networkstatus.c | |
parent | cc02823d7f6acbc3fa8ea87e5646921100796f10 (diff) | |
download | tor-9c29369a04cdf47bd882579331577d82305bf785.tar.gz tor-9c29369a04cdf47bd882579331577d82305bf785.zip |
Convert instances of tor_malloc+tor_snprintf into tor_asprintf
These were found by looking for tor_snprintf() instances that were
preceeded closely by tor_malloc(), though I probably converted some
more snprintfs as well.
(In every case, make sure that the length variable (if any) is
removed, renamed, or lowered, so that anything else that might have
assumed a longer buffer doesn't exist.)
Diffstat (limited to 'src/or/networkstatus.c')
-rw-r--r-- | src/or/networkstatus.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/src/or/networkstatus.c b/src/or/networkstatus.c index 0a1fc08bf7..a4e8644f23 100644 --- a/src/or/networkstatus.c +++ b/src/or/networkstatus.c @@ -2159,9 +2159,8 @@ networkstatus_dump_bridge_status_to_file(time_t now) { char *status = networkstatus_getinfo_by_purpose("bridge", now); const or_options_t *options = get_options(); - size_t len = strlen(options->DataDirectory) + 32; - char *fname = tor_malloc(len); - tor_snprintf(fname, len, "%s"PATH_SEPARATOR"networkstatus-bridges", + char *fname = NULL; + tor_asprintf(&fname, "%s"PATH_SEPARATOR"networkstatus-bridges", options->DataDirectory); write_str_to_file(fname,status,0); tor_free(fname); |