From 1386aa57da4a1c5994e5aa9027b7b91e8ea065b7 Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Wed, 22 Jul 2015 11:02:45 -0700 Subject: [PATCH] repair to NLPacket creation from Packet and char* --- libraries/networking/src/LimitedNodeList.cpp | 2 +- libraries/networking/src/NLPacket.cpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/libraries/networking/src/LimitedNodeList.cpp b/libraries/networking/src/LimitedNodeList.cpp index 648fb7f2a0..1aee0e2da4 100644 --- a/libraries/networking/src/LimitedNodeList.cpp +++ b/libraries/networking/src/LimitedNodeList.cpp @@ -619,7 +619,7 @@ void LimitedNodeList::sendSTUNRequest() { flagTimeForConnectionStep(ConnectionStep::SendSTUNRequest); - _nodeSocket.writeDatagram(QByteArray::fromRawData(stunRequestPacket, sizeof(stunRequestPacket)), _stunSockAddr); + _nodeSocket.writeDatagram(stunRequestPacket, sizeof(stunRequestPacket), _stunSockAddr); } bool LimitedNodeList::processSTUNResponse(QSharedPointer packet) { diff --git a/libraries/networking/src/NLPacket.cpp b/libraries/networking/src/NLPacket.cpp index fdfb94f107..1af8dd0019 100644 --- a/libraries/networking/src/NLPacket.cpp +++ b/libraries/networking/src/NLPacket.cpp @@ -112,7 +112,7 @@ NLPacket& NLPacket::operator=(const NLPacket& other) { NLPacket::NLPacket(std::unique_ptr data, qint64 size, const HifiSockAddr& senderSockAddr) : Packet(std::move(data), size, senderSockAddr) { - adjustPayloadStartAndCapacity(); + adjustPayloadStartAndCapacity(_payloadSize > 0); readSourceID(); } @@ -148,7 +148,7 @@ QByteArray NLPacket::hashForPacketAndSecret(const udt::Packet& packet, const QUu int offset = packet.Packet::localHeaderSize() + NUM_BYTES_RFC4122_UUID + NUM_BYTES_MD5_HASH; // add the packet payload and the connection UUID - hash.addData(packet.getData(), packet.getDataSize() - offset); + hash.addData(packet.getData() + offset, packet.getDataSize() - offset); hash.addData(connectionSecret.toRfc4122()); // return the hash