fix(master): a cut password skips what it cut, and a starting private instance answers once ready

A capped string now skips the characters it cut, so what follows it is read from the
right place. A request to join a private instance that is still starting is answered
once its world server is ready, instead of at once with an address nothing listens
on yet.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
Aaron Kimbrell
2026-11-10 18:37:35 -06:00
parent 37cc844562
commit 11a70ad870
3 changed files with 29 additions and 1 deletions

View File

@@ -16,7 +16,12 @@ namespace {
uint32_t length{};
VALIDATE_READ(bitStream.Read(length));
value.resize(std::min(length, maxLength));
return value.empty() || bitStream.ReadBits(reinterpret_cast<unsigned char*>(value.data()), BYTES_TO_BITS(value.size()), true);
if (!value.empty() && !bitStream.ReadBits(reinterpret_cast<unsigned char*>(value.data()), BYTES_TO_BITS(value.size()), true)) return false;
const uint32_t rest = length - static_cast<uint32_t>(value.size());
if (rest == 0) return true;
if (BITS_TO_BYTES(bitStream.GetNumberOfUnreadBits()) < rest) return false;
bitStream.IgnoreBits(BYTES_TO_BITS(rest));
return true;
}
}