Debugging and resolving problems with interest serialization/deserialization
diff --git a/helper/ccnb-parser/syntax-tree/ccnb-parser-tag.cc b/helper/ccnb-parser/syntax-tree/ccnb-parser-tag.cc
index c288be9..5862ad4 100644
--- a/helper/ccnb-parser/syntax-tree/ccnb-parser-tag.cc
+++ b/helper/ccnb-parser/syntax-tree/ccnb-parser-tag.cc
@@ -28,10 +28,13 @@
Tag::Tag (Buffer::Iterator &start, uint32_t length)
{
m_tag.reserve (length+2); // extra byte for potential \0 at the end
- for (uint32_t i = 0; i < (length+1); i++)
+ uint32_t i = 0;
+ for (; !start.IsEnd () && i < (length+1); i++)
{
m_tag.push_back (start.ReadU8 ());
}
+ if (i < (length+1) && start.IsEnd ())
+ throw CcnbDecodingException ();
// parse attributes until first nested block reached
while (!start.IsEnd () && start.PeekU8 ()!=CCN_CLOSE)