Fix incorrect prefix comparison

Former-commit-id: 1ef167546be0678edd457d65a5368e8706fde0a3
This commit is contained in:
John Sully 2020-03-23 22:51:46 -04:00
parent 0381e728ab
commit bb3314c0d9

View File

@ -3,13 +3,13 @@
#include <sstream>
#include <mutex>
static const char *keyprefix = INTERNAL_KEY_PREFIX;
static const char keyprefix[] = INTERNAL_KEY_PREFIX;
bool FInternalKey(const char *key, size_t cch)
{
if (cch > strlen(INTERNAL_KEY_PREFIX))
if (cch >= sizeof(INTERNAL_KEY_PREFIX))
{
if (memcmp(key, keyprefix, strlen(INTERNAL_KEY_PREFIX)) == 0)
if (memcmp(key, keyprefix, sizeof(INTERNAL_KEY_PREFIX)-1) == 0)
return true;
}
return false;