Fix bounds check in kv_db (fix invalid input handling?)

This commit is contained in:
Vitaliy Filippov
2026-06-20 11:43:33 +03:00
parent d2cf271f64
commit 8c0486bd76
+1 -1
View File
@@ -233,7 +233,7 @@ static std::string read_string(uint8_t *data, int size, int *pos)
}
uint32_t len = *(uint32_t*)(data+*pos);
*pos += sizeof(uint32_t);
if (*pos+len > size)
if (len > size-*pos)
{
*pos = -1;
return "";