mirror of
https://codeberg.org/anoncontributorxmr/monero.git
synced 2024-11-14 07:03:29 +01:00
Merge pull request #6157
402dd207
db_lmdb: guard against non NUL terminated keys (moneromooo-monero)
This commit is contained in:
commit
e51ce477db
@ -163,7 +163,15 @@ int BlockchainLMDB::compare_string(const MDB_val *a, const MDB_val *b)
|
|||||||
{
|
{
|
||||||
const char *va = (const char*) a->mv_data;
|
const char *va = (const char*) a->mv_data;
|
||||||
const char *vb = (const char*) b->mv_data;
|
const char *vb = (const char*) b->mv_data;
|
||||||
return strcmp(va, vb);
|
const size_t sz = std::min(a->mv_size, b->mv_size);
|
||||||
|
int ret = strncmp(va, vb, sz);
|
||||||
|
if (ret)
|
||||||
|
return ret;
|
||||||
|
if (a->mv_size < b->mv_size)
|
||||||
|
return -1;
|
||||||
|
if (a->mv_size > b->mv_size)
|
||||||
|
return 1;
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user