[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [tor/master] Assert that we aren't returning a pointer to a local variable.
commit 620108ea7770608de72dcbea4ca73d6fb99c1109
Author: Nick Mathewson <nickm@xxxxxxxxxxxxxx>
Date: Tue Sep 18 14:34:49 2018 -0400
Assert that we aren't returning a pointer to a local variable.
GCC got confused here with LTO enabled.
Fixes part of #27772.
---
src/feature/nodelist/routerparse.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/src/feature/nodelist/routerparse.c b/src/feature/nodelist/routerparse.c
index b76b2974f..ae57fbe49 100644
--- a/src/feature/nodelist/routerparse.c
+++ b/src/feature/nodelist/routerparse.c
@@ -4436,7 +4436,9 @@ router_parse_addr_policy(directory_token_t *tok, unsigned fmt_flags)
return NULL;
}
- return addr_policy_get_canonical_entry(&newe);
+ addr_policy_t *result = addr_policy_get_canonical_entry(&newe);
+ tor_assert(result != &newe); // We aren't returning the one from the stack.
+ return result;
}
/** Parse an exit policy line of the format "accept[6]/reject[6] private:...".
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits