From b18ee6d9bc467324667f9f5e64b9326cd89bf502 Mon Sep 17 00:00:00 2001 From: Tom Wambold Date: Tue, 29 Dec 2009 13:09:26 -0500 Subject: [PATCH] Fixed bug in serialization of PbbAddressBlock. PbbAddressBlock would not set its flags correctly when there was only a single address in the address block. --- src/node/packetbb.cc | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/node/packetbb.cc b/src/node/packetbb.cc index 67bde24cf..51a9507c5 100644 --- a/src/node/packetbb.cc +++ b/src/node/packetbb.cc @@ -2014,11 +2014,12 @@ void PbbAddressBlock::Serialize (Buffer::Iterator &start) const { start.WriteU8 (AddressSize ()); + Buffer::Iterator bufref = start; + uint8_t flags = 0; + start.Next (); if (AddressSize () == 1) { - start.WriteU8 (0); - uint8_t buf[GetAddressLength ()]; SerializeAddress (buf, AddressBegin ()); start.Write (buf, GetAddressLength ()); @@ -2026,14 +2027,12 @@ PbbAddressBlock::Serialize (Buffer::Iterator &start) const if (PrefixSize () == 1) { start.WriteU8 (PrefixFront ()); + flags |= AHAS_SINGLE_PRE_LEN; } + bufref.WriteU8 (flags); } else if (AddressSize () > 0) { - Buffer::Iterator bufref = start; - uint8_t flags = 0; - start.Next (); - uint8_t head[GetAddressLength ()]; uint8_t tail[GetAddressLength ()]; uint8_t headlen = 0;