Browse Source

Merge branch 'maint-0.2.7-redux' into maint-0.2.8

Nick Mathewson 6 years ago
parent
commit
33fcc0f61d
2 changed files with 4 additions and 1 deletions
  1. 3 0
      changes/bug22490
  2. 1 1
      src/or/geoip.c

+ 3 - 0
changes/bug22490

@@ -0,0 +1,3 @@
+  o Minor bugfixes (correctness):
+    - Avoid undefined behavior when parsing IPv6 entries from the geoip6
+      file. Fixes bug 22490; bugfix on 0.2.4.6-alpha.

+ 1 - 1
src/or/geoip.c

@@ -144,6 +144,7 @@ geoip_parse_entry(const char *line, sa_family_t family)
   if (*line == '#')
     return 0;
 
+  char buf[512];
   if (family == AF_INET) {
     unsigned int low, high;
     if (tor_sscanf(line,"%u,%u,%2s", &low, &high, c) == 3 ||
@@ -154,7 +155,6 @@ geoip_parse_entry(const char *line, sa_family_t family)
       goto fail;
     country = c;
   } else {                      /* AF_INET6 */
-    char buf[512];
     char *low_str, *high_str;
     struct in6_addr low, high;
     char *strtok_state;