From 6a069959c6afac90231def95712b08b887735192 Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Thu, 1 Dec 2016 10:36:02 -0500 Subject: [PATCH 1/2] Fix major errors in freeing getaddrinfo sandbox cache Patch from cypherpunks. Fixes bug 20710; bugfix on 0.2.5.5-alpha. --- src/common/sandbox.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/common/sandbox.c b/src/common/sandbox.c index e43b64b91..105900777 100644 --- a/src/common/sandbox.c +++ b/src/common/sandbox.c @@ -1486,13 +1486,14 @@ sandbox_add_addrinfo(const char *name) void sandbox_free_getaddrinfo_cache(void) { - cached_getaddrinfo_item_t **next, **item; + cached_getaddrinfo_item_t **next, **item, *this; for (item = HT_START(getaddrinfo_cache, &getaddrinfo_cache); item; item = next) { + this = *item; next = HT_NEXT_RMV(getaddrinfo_cache, &getaddrinfo_cache, item); - cached_getaddrinfo_item_free(*item); + cached_getaddrinfo_item_free(this); } HT_CLEAR(getaddrinfo_cache, &getaddrinfo_cache); From 045a50e45a74b9e403a320e4d3590a8eb0793d09 Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Wed, 7 Dec 2016 10:51:39 -0500 Subject: [PATCH 2/2] Forgot to add changes file for 20710. --- changes/bug20710_025 | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 changes/bug20710_025 diff --git a/changes/bug20710_025 b/changes/bug20710_025 new file mode 100644 index 000000000..12bd07536 --- /dev/null +++ b/changes/bug20710_025 @@ -0,0 +1,4 @@ + o Minor bugfixes (memory leak, use-after-free, linux seccomp2 sandbox): + - Fix a memory leak and use-after-free error when removing entries + from the sandbox's getaddrinfo() cache. Fixes bug 20710; bugfix on + 0.2.5.5-alpha. Patch from "cypherpunks".