[keel] Fix string comparison bug in K1 header check

This commit is contained in:
Gary Talent 2023-06-03 15:37:09 -05:00
parent ed169eb9b8
commit 6f4b869fa2

View File

@ -12,11 +12,11 @@ ox::Result<ox::UUID> readUuidHeader(const ox::Buffer &buff) noexcept {
ox::Result<ox::UUID> readUuidHeader(const char *buff, std::size_t buffLen) noexcept { ox::Result<ox::UUID> readUuidHeader(const char *buff, std::size_t buffLen) noexcept {
if (buffLen < K1HdrSz) { if (buffLen < K1HdrSz) {
return OxError(1, "Insufficient data to contain complete Nostalgia header"); return OxError(1, "Insufficient data to contain complete Keel header");
} }
constexpr ox::StringView k1Hdr = "K1;"; constexpr ox::StringView k1Hdr = "K1;";
if (k1Hdr == buff) { if (k1Hdr != ox::StringView(buff, k1Hdr.bytes())) {
return OxError(2, "No Nostalgia asset header data"); return OxError(2, "No Keel asset header data");
} }
return ox::UUID::fromString(ox::StringView(buff + k1Hdr.bytes(), 36)); return ox::UUID::fromString(ox::StringView(buff + k1Hdr.bytes(), 36));
} }