diff options
author | Nick Mathewson <nickm@torproject.org> | 2017-06-05 11:59:57 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2017-06-05 11:59:57 -0400 |
commit | df23e280c4419762b3c800badd5992d84ee8797c (patch) | |
tree | 8535f7b010516f27dd6c3bfd07cd1b5b3a6eb13c | |
parent | cdc960b538d677c5434a91eec7b25a93c93df0fa (diff) | |
parent | e3ebae48040b9ed3946e65dbc6a24e8f5e48ff6b (diff) | |
download | tor-df23e280c4419762b3c800badd5992d84ee8797c.tar.gz tor-df23e280c4419762b3c800badd5992d84ee8797c.zip |
Merge branch 'maint-0.2.4' into release-0.2.4
-rw-r--r-- | changes/bug22490 | 3 | ||||
-rw-r--r-- | src/or/geoip.c | 2 |
2 files changed, 4 insertions, 1 deletions
diff --git a/changes/bug22490 b/changes/bug22490 new file mode 100644 index 0000000000..244dd50b36 --- /dev/null +++ b/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. diff --git a/src/or/geoip.c b/src/or/geoip.c index e2e98e8ec4..4abd5191f4 100644 --- a/src/or/geoip.c +++ b/src/or/geoip.c @@ -145,6 +145,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 || @@ -155,7 +156,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; |