damus

nostr ios client
git clone git://jb55.com/damus
Log | Files | Refs | README | LICENSE

commit 12a7b483a0ed15a028d1509f172215bcd87e3e9c
parent caa7802bce2ff07a4bd579e586b94d0bd8f46b41
Author: Daniel D’Aquino <daniel@daquino.me>
Date:   Fri, 11 Jul 2025 16:44:55 -0700

Fix incorrect buffer size argument in block parsing

Changelog-None
Signed-off-by: Daniel D’Aquino <daniel@daquino.me>

Diffstat:
Mnostrdb/src/nostrdb.c | 6++++--
1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/nostrdb/src/nostrdb.c b/nostrdb/src/nostrdb.c @@ -7095,12 +7095,14 @@ static struct ndb_blocks *ndb_note_to_blocks(struct ndb_note *note) // something weird is going on if (content_len >= INT32_MAX) return NULL; + + uint32_t buf_size = 2<<18; - buffer = malloc(2<<18); // Not carefully calculated, but ok because we will not need this once we switch to the local relay model + buffer = malloc(buf_size); // Not carefully calculated, but ok because we will not need this once we switch to the local relay model if (!buffer) return NULL; - if (!ndb_parse_content(buffer, content_len, content, content_len, &blocks)) { + if (!ndb_parse_content(buffer, buf_size, content, content_len, &blocks)) { free(buffer); return NULL; }