mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-10 21:23:58 +01:00
Merge remote-tracking branch 'origin/maint-0.2.3'
This commit is contained in:
commit
582f2187a7
9
changes/bug6827
Normal file
9
changes/bug6827
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
o Minor bugfixes:
|
||||||
|
|
||||||
|
- Avoid undefined behaviour when parsing the list of supported
|
||||||
|
rendezvous/introduction protocols in a hidden service
|
||||||
|
descriptor. Previously, Tor would have confused (as-yet-unused)
|
||||||
|
protocol version numbers greater than 32 with lower ones on many
|
||||||
|
platforms. Fixes bug 6827; bugfix on 0.2.0.10-alpha; found by
|
||||||
|
George Kadianakis.
|
||||||
|
|
@ -4292,14 +4292,17 @@ typedef struct rend_intro_point_t {
|
|||||||
time_t time_expiring;
|
time_t time_expiring;
|
||||||
} rend_intro_point_t;
|
} rend_intro_point_t;
|
||||||
|
|
||||||
|
#define REND_PROTOCOL_VERSION_BITMASK_WIDTH 16
|
||||||
|
|
||||||
/** Information used to connect to a hidden service. Used on both the
|
/** Information used to connect to a hidden service. Used on both the
|
||||||
* service side and the client side. */
|
* service side and the client side. */
|
||||||
typedef struct rend_service_descriptor_t {
|
typedef struct rend_service_descriptor_t {
|
||||||
crypto_pk_t *pk; /**< This service's public key. */
|
crypto_pk_t *pk; /**< This service's public key. */
|
||||||
int version; /**< Version of the descriptor format: 0 or 2. */
|
int version; /**< Version of the descriptor format: 0 or 2. */
|
||||||
time_t timestamp; /**< Time when the descriptor was generated. */
|
time_t timestamp; /**< Time when the descriptor was generated. */
|
||||||
uint16_t protocols; /**< Bitmask: which rendezvous protocols are supported?
|
/** Bitmask: which rendezvous protocols are supported?
|
||||||
* (We allow bits '0', '1', and '2' to be set.) */
|
* (We allow bits '0', '1', and '2' to be set.) */
|
||||||
|
int protocols : REND_PROTOCOL_VERSION_BITMASK_WIDTH;
|
||||||
/** List of the service's introduction points. Elements are removed if
|
/** List of the service's introduction points. Elements are removed if
|
||||||
* introduction attempts fail. */
|
* introduction attempts fail. */
|
||||||
smartlist_t *intro_nodes;
|
smartlist_t *intro_nodes;
|
||||||
|
@ -4854,6 +4854,9 @@ rend_parse_v2_service_descriptor(rend_service_descriptor_t **parsed_out,
|
|||||||
10, 0, INT_MAX, &num_ok, NULL);
|
10, 0, INT_MAX, &num_ok, NULL);
|
||||||
if (!num_ok) /* It's a string; let's ignore it. */
|
if (!num_ok) /* It's a string; let's ignore it. */
|
||||||
continue;
|
continue;
|
||||||
|
if (version >= REND_PROTOCOL_VERSION_BITMASK_WIDTH)
|
||||||
|
/* Avoid undefined left-shift behaviour. */
|
||||||
|
continue;
|
||||||
result->protocols |= 1 << version;
|
result->protocols |= 1 << version;
|
||||||
}
|
}
|
||||||
SMARTLIST_FOREACH(versions, char *, cp, tor_free(cp));
|
SMARTLIST_FOREACH(versions, char *, cp, tor_free(cp));
|
||||||
|
Loading…
Reference in New Issue
Block a user