From 7e65871ccc49f6f25f8782789283cf2afef6e86b Mon Sep 17 00:00:00 2001 From: Karsten Loesing Date: Mon, 25 Jan 2010 18:44:17 +0000 Subject: Fix a memory corruption bug while collecting bridge stats We accidentally freed the internal buffer for bridge stats when we were writing the bridge stats file or honoring a control port request for said data. Change the interfaces for geoip_get_bridge_stats* to prevent these problems, and remove the offending free/add a tor_strdup. Fixes bug 1208. --- src/or/microdesc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/or/microdesc.c') diff --git a/src/or/microdesc.c b/src/or/microdesc.c index a754200764..f29611f930 100644 --- a/src/or/microdesc.c +++ b/src/or/microdesc.c @@ -77,7 +77,8 @@ dump_microdescriptor(FILE *f, microdesc_t *md, size_t *annotation_len_out) md->off = (off_t) ftell(f); written = fwrite(md->body, 1, md->bodylen, f); if (written != md->bodylen) { - log_warn(LD_DIR, "Couldn't dump microdescriptor (wrote %lu out of %lu): %s", + log_warn(LD_DIR, + "Couldn't dump microdescriptor (wrote %lu out of %lu): %s", (unsigned long)written, (unsigned long)md->bodylen, strerror(ferror(f))); return -1; -- cgit v1.2.3-54-g00ecf