Fix an off-by-one error

This commit is contained in:
Petri Lehtinen 2013-10-15 08:49:40 +03:00
parent 08be94e8e6
commit 30a4c88843

View File

@ -251,7 +251,7 @@ int hashtable_set(hashtable_t *hashtable,
allocated. */
size_t len = strlen(key);
if(len > (size_t)-1 - offsetof(pair_t, key)) {
if(len >= (size_t)-1 - offsetof(pair_t, key)) {
/* Avoid an overflow if the key is very long */
return -1;
}