gossipd: don't try to handle padding inside fromwire_ipaddr.

It makes it impossible to embed an ipaddr in another structure, since we
always try to skip over any zeroes, which may swallow a following field.

Do the skip specially for the case where we're parsing routing messages:
we never use padding for our own internal messages anyway.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell
2017-10-23 00:03:58 +10:30
committed by Christian Decker
parent c2dd0cb295
commit 7e022b522c
5 changed files with 10 additions and 10 deletions

View File

@@ -637,6 +637,10 @@ static struct ipaddr *read_addresses(const tal_t *ctx, const u8 *ser)
while (cursor && cursor < ser + max) {
struct ipaddr ipaddr;
/* Skip any padding */
while (max && cursor[0] == ADDR_TYPE_PADDING)
fromwire_u8(&cursor, &max);
/* BOLT #7:
*
* The receiving node SHOULD ignore the first `address