]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Switch geoip_get_request_history to asprintf; fix bug 1365
authorNick Mathewson <nickm@torproject.org>
Tue, 20 Apr 2010 05:09:40 +0000 (01:09 -0400)
committerNick Mathewson <nickm@torproject.org>
Tue, 20 Apr 2010 05:09:40 +0000 (01:09 -0400)
changes/fix_bug_1365 [new file with mode: 0644]
src/or/geoip.c

diff --git a/changes/fix_bug_1365 b/changes/fix_bug_1365
new file mode 100644 (file)
index 0000000..7302731
--- /dev/null
@@ -0,0 +1,4 @@
+ o Minor bugfixes:
+   - Fix a segfault when DirReqStatistics is enabled.  Bug found by keb.
+     Fixes bug 1365; bugfix on 0.2.2.11-alpha.
+
index b5a0374c492b1be6617a032b8ff0ae6b9fac723d..ea11dc323df7d8495d190728b3bca2629b902e21 100644 (file)
@@ -945,8 +945,8 @@ geoip_get_request_history(time_t now, geoip_client_action_t action)
 
   strings = smartlist_create();
   SMARTLIST_FOREACH(entries, c_hist_t *, ent, {
-      char buf[32];
-      tor_snprintf(buf, sizeof(buf), "%s=%u", ent->country, ent->total);
+      char *buf = NULL;
+      tor_asprintf(&buf, "%s=%u", ent->country, ent->total);
       smartlist_add(strings, buf);
     });
   result = smartlist_join_strings(strings, ",", 0, NULL);