nostrdb: nostrdb: fix ndb_builder_find_str.
This will find strings which match the beginning of other strings, which seems wrong. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> Signed-off-by: William Casarin <jb55@jb55.com>
This commit is contained in:
committed by
Daniel D’Aquino
parent
30c5225ed0
commit
ddd30054e8
@@ -5071,7 +5071,7 @@ static inline int ndb_builder_find_str(struct ndb_builder *builder,
|
||||
uint32_t index = ((uint32_t*)builder->str_indices.start)[i];
|
||||
const char *some_str = (const char*)builder->strings.start + index;
|
||||
|
||||
if (!memcmp(some_str, str, len)) {
|
||||
if (!memcmp(some_str, str, len) && some_str[len] == '\0') {
|
||||
// found an existing matching str, use that index
|
||||
*pstr = ndb_offset_str(index);
|
||||
return 1;
|
||||
|
||||
Reference in New Issue
Block a user