[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[or-cvs] [tor/master] Switch geoip_get_request_history to asprintf; fix bug 1365



Author: Nick Mathewson <nickm@xxxxxxxxxxxxxx>
Date: Tue, 20 Apr 2010 01:09:40 -0400
Subject: Switch geoip_get_request_history to asprintf; fix bug 1365
Commit: f2c30e97cc61204d43040fc9d82ea114a87afdeb

---
 changes/fix_bug_1365 |    4 ++++
 src/or/geoip.c       |    4 ++--
 2 files changed, 6 insertions(+), 2 deletions(-)
 create mode 100644 changes/fix_bug_1365

diff --git a/changes/fix_bug_1365 b/changes/fix_bug_1365
new file mode 100644
index 0000000..7302731
--- /dev/null
+++ b/changes/fix_bug_1365
@@ -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.
+
diff --git a/src/or/geoip.c b/src/or/geoip.c
index b5a0374..ea11dc3 100644
--- a/src/or/geoip.c
+++ b/src/or/geoip.c
@@ -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);
-- 
1.6.5