[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [tor/master] Check the return value of hs_parse_address().
commit 9fa38bd996e345990b81bce0995a25be2ee4c98f
Author: Alexander Færøy <ahf@xxxxxxxxxxxxxx>
Date: Wed Dec 6 14:52:02 2017 +0100
Check the return value of hs_parse_address().
This patch adds a check for the return value of `hs_parse_address()` in
`hs_control_hspost_command()`. Since it should not be possible for
`hs_parse_address()` to fail in this context we wrap the error check
with the `BUG()` macro.
See: https://bugs.torproject.org/24543
---
src/or/hs_control.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/src/or/hs_control.c b/src/or/hs_control.c
index 1b1fe7857..87b4e3fca 100644
--- a/src/or/hs_control.c
+++ b/src/or/hs_control.c
@@ -222,7 +222,9 @@ hs_control_hspost_command(const char *body, const char *onion_address,
/* This can't fail because we require the caller to pass us a valid onion
* address that has passed hs_address_is_valid(). */
- hs_parse_address(onion_address, &identity_pk, NULL, NULL);
+ if (BUG(hs_parse_address(onion_address, &identity_pk, NULL, NULL) < 0)) {
+ goto done; // LCOV_EXCL_LINE
+ }
/* Only decode the plaintext part which is what the directory will do to
* validate before caching. */
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits