Fix bounds check in kv_db (fix invalid input handling?)
This commit is contained in:
+1
-1
@@ -233,7 +233,7 @@ static std::string read_string(uint8_t *data, int size, int *pos)
|
|||||||
}
|
}
|
||||||
uint32_t len = *(uint32_t*)(data+*pos);
|
uint32_t len = *(uint32_t*)(data+*pos);
|
||||||
*pos += sizeof(uint32_t);
|
*pos += sizeof(uint32_t);
|
||||||
if (*pos+len > size)
|
if (len > size-*pos)
|
||||||
{
|
{
|
||||||
*pos = -1;
|
*pos = -1;
|
||||||
return "";
|
return "";
|
||||||
|
|||||||
Reference in New Issue
Block a user