Skip to content

Commit

Permalink
consider length of string keys
Browse files Browse the repository at this point in the history
take length into account so perfect sub-strings do not match incorrectly
  • Loading branch information
mdrossmiller authored Oct 25, 2024
1 parent 8eeecba commit 4e1b707
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion external/hash/str_set.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ DEFINE_HASH_TABLE(str_set)
*/
static inline int ht_match(const void *key, size_t len, str_set_item_t item)
{
return strncmp(key, item, len) == 0;
return len == strlen(item) && strncmp(key, item, len) == 0;
}

static inline const void *ht_key(str_set_item_t item)
Expand Down

0 comments on commit 4e1b707

Please sign in to comment.