diff --git a/libraries/networking/src/udt/SaltShaker.cpp b/libraries/networking/src/udt/SaltShaker.cpp index 73c59f7925..4febaa789a 100644 --- a/libraries/networking/src/udt/SaltShaker.cpp +++ b/libraries/networking/src/udt/SaltShaker.cpp @@ -27,12 +27,10 @@ void saltingHelper(char* start, int size, Key key) { const auto end = start + size; auto p = start; - for (; p < end; p += sizeof(Key)) { + for (; p + sizeof(Key) < end; p += sizeof(Key)) { *reinterpret_cast(p) ^= key; } - p -= sizeof(Key); - for (int i = 0; p < end; ++p || ++i) { *p ^= *(reinterpret_cast(&key) + i); }