Fix an off-by-one error
This commit is contained in:
parent
08be94e8e6
commit
30a4c88843
@ -251,7 +251,7 @@ int hashtable_set(hashtable_t *hashtable,
|
|||||||
allocated. */
|
allocated. */
|
||||||
|
|
||||||
size_t len = strlen(key);
|
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 */
|
/* Avoid an overflow if the key is very long */
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user