<div dir="ltr">I'm using protobuf to send packets, I can serialize and deserialize them just fine in the code I link below, even if I set one of the members to 0 (e.g. set_versionminor(0). It works fine if I serialize the contents, then do ss2 << ss.str(); to put that data into another buffer which i then deserialize..<div>

<br></div><div style>I did that just for testing, and it works fine.</div><div style><br></div><div style>However, as soon as I put the contents in an ENetPacket, with ENetPacket *packet = enet_packet_create(ss.str().c_str(), ss.str().size(), ENET_PACKET_FLAG_RELIABLE);</div>

<div style><br></div><div style>and     std::stringstream ss2; ss2 << (packet->data);</div><div style><br></div><div style>it breaks if one of those set_.. members are set to 0. I belief this has something to do with \0 the NUL terminator..but I'm not sure what's going on.</div>

<div style><br></div><div style>All I know is that it works until I make a packet out of it, at which point if the data i serialized had a 0 in it, my deserialization breaks down entirely.</div><div style><br></div><div style>

Maybe it has something to do with the fact that packet->data is an enet_uint8?</div><div style><br></div><div style>code below, I omitted my de/serializer because it doesn't seem to be the issue, but how i actually store it in the packet and retrieve it.</div>

<div style><br></div><div style><a href="http://paste.kde.org/669368/">http://paste.kde.org/669368/</a><br></div></div>