mirror of
https://github.com/overte-org/overte.git
synced 2025-04-20 04:44:11 +02:00
Merge pull request #7484 from Atlante45/fix/atp-req-limit
Fix segfault with gxx
This commit is contained in:
commit
1df7cf5c8d
1 changed files with 6 additions and 9 deletions
|
@ -15,6 +15,8 @@
|
|||
|
||||
#include <LogHandler.h>
|
||||
|
||||
#include "Socket.h"
|
||||
|
||||
using namespace udt;
|
||||
|
||||
static int packetMetaTypeId = qRegisterMetaType<Packet*>("Packet*");
|
||||
|
@ -28,15 +30,10 @@ static const std::array<Key, 4> KEYS {{
|
|||
}};
|
||||
|
||||
void xorHelper(char* start, int size, Key key) {
|
||||
const auto end = start + size;
|
||||
|
||||
auto p = start;
|
||||
for (; p + sizeof(Key) < end; p += sizeof(Key)) {
|
||||
*reinterpret_cast<Key*>(p) ^= key;
|
||||
}
|
||||
|
||||
for (int i = 0; p < end; ++p || ++i) {
|
||||
*p ^= *(reinterpret_cast<const char*>(&key) + i);
|
||||
auto current = start;
|
||||
auto xorValue = reinterpret_cast<const char*>(&key);
|
||||
for (int i = 0; i < size; ++i) {
|
||||
*(current++) ^= *(xorValue + (i % sizeof(Key)));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue