From d938f31fab99035e25dae123b9ef0476a7fe893d Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Thu, 23 Jul 2015 17:10:40 -0700 Subject: [PATCH] fix for write of sourceID and verificationHash --- libraries/networking/src/NLPacket.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libraries/networking/src/NLPacket.cpp b/libraries/networking/src/NLPacket.cpp index eb53688a21..5de7d3065f 100644 --- a/libraries/networking/src/NLPacket.cpp +++ b/libraries/networking/src/NLPacket.cpp @@ -233,7 +233,7 @@ void NLPacket::readSourceID() { void NLPacket::writeSourceID(const QUuid& sourceID) { Q_ASSERT(!NON_SOURCED_PACKETS.contains(_type)); - auto offset = Packet::localHeaderSize(); + auto offset = Packet::localHeaderSize() + sizeof(PacketType) + sizeof(PacketVersion); memcpy(_packet.get() + offset, sourceID.toRfc4122().constData(), NUM_BYTES_RFC4122_UUID); _sourceID = sourceID; @@ -242,7 +242,7 @@ void NLPacket::writeSourceID(const QUuid& sourceID) { void NLPacket::writeVerificationHashGivenSecret(const QUuid& connectionSecret) { Q_ASSERT(!NON_SOURCED_PACKETS.contains(_type) && !NON_VERIFIED_PACKETS.contains(_type)); - auto offset = Packet::localHeaderSize() + NUM_BYTES_RFC4122_UUID; + auto offset = Packet::localHeaderSize() + sizeof(PacketType) + sizeof(PacketVersion) + NUM_BYTES_RFC4122_UUID; QByteArray verificationHash = hashForPacketAndSecret(*this, connectionSecret); memcpy(_packet.get() + offset, verificationHash.data(), verificationHash.size());