]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
core/or: Check extends for zero addresses and ports
authorteor <teor@torproject.org>
Tue, 14 Apr 2020 05:53:17 +0000 (15:53 +1000)
committerteor <teor@torproject.org>
Wed, 29 Apr 2020 12:43:09 +0000 (22:43 +1000)
Check for invalid zero IPv4 addresses and ports, when sending and
receiving extend cells.

Fixes bug 33900; bugfix on 0.2.4.8-alpha.

changes/bug33900 [new file with mode: 0644]
src/core/or/onion.c

diff --git a/changes/bug33900 b/changes/bug33900
new file mode 100644 (file)
index 0000000..c1649d2
--- /dev/null
@@ -0,0 +1,3 @@
+  o Minor bugfixes (IPv4, relay):
+    - Check for invalid zero IPv4 addresses and ports, when sending and
+      receiving extend cells. Fixes bug 33900; bugfix on 0.2.4.8-alpha.
index 543d9f3e47e2578ef4645a0b839fcb17d0b6884c..d73f981d2c60ef3d25627ac817bef99aa0d42b0c 100644 (file)
@@ -244,14 +244,14 @@ check_extend_cell(const extend_cell_t *cell)
 
   if (tor_digest_is_zero((const char*)cell->node_id))
     return -1;
-  if (tor_addr_family(&cell->orport_ipv4.addr) == AF_UNSPEC) {
+  if (!tor_addr_port_is_valid_ap(&cell->orport_ipv4, 0)) {
     /* EXTEND cells must have an IPv4 address. */
     if (!is_extend2) {
       return -1;
     }
     /* EXTEND2 cells must have at least one IP address.
      * It can be IPv4 or IPv6. */
-    if (tor_addr_family(&cell->orport_ipv6.addr) == AF_UNSPEC) {
+    if (!tor_addr_port_is_valid_ap(&cell->orport_ipv6, 0)) {
       return -1;
     }
   }