diff options
author | Nick Mathewson <nickm@torproject.org> | 2017-06-05 12:02:15 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2017-06-05 12:02:15 -0400 |
commit | d75be189df970f0da3a59f649e3be9c5d57868c6 (patch) | |
tree | 8f779c6dc6d6ba629d71272a4718be61d1884b13 | |
parent | ec61ae59a5d009a9e80f3bfa9a2aa5f5dfa05551 (diff) | |
parent | 33fcc0f61d1feb2fbdf3153c7c64780dcdce6767 (diff) | |
download | tor-d75be189df970f0da3a59f649e3be9c5d57868c6.tar.gz tor-d75be189df970f0da3a59f649e3be9c5d57868c6.zip |
Merge branch 'maint-0.2.8' into maint-0.2.9
-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 ba65dfe56c..00c055bbe7 100644 --- a/src/or/geoip.c +++ b/src/or/geoip.c @@ -162,6 +162,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 || @@ -172,7 +173,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; |