damus

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

commit 6c53bc75f28f59757062a4f736a3285a8701c7b1
parent 60010637549d8a1754e540523bdfb6e388b47e99
Author: William Casarin <jb55@jb55.com>
Date:   Wed, 28 Aug 2024 15:22:17 +0300

nostrdb: content_parser: fix blocks_size

we are crossing cursors

Signed-off-by: William Casarin <jb55@jb55.com>

Diffstat:
Mnostrdb/src/content_parser.c | 6+++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/nostrdb/src/content_parser.c b/nostrdb/src/content_parser.c @@ -522,7 +522,7 @@ int ndb_parse_content(unsigned char *buf, int buf_size, struct ndb_content_parser parser; struct ndb_block block; - unsigned char *start, *pre_mention, *blocks_start; + unsigned char *start, *pre_mention; make_cursor(buf, buf + buf_size, &parser.buffer); @@ -539,7 +539,7 @@ int ndb_parse_content(unsigned char *buf, int buf_size, parser.blocks->flags = 0; parser.blocks->version = 1; - blocks_start = start = parser.content.p; + start = parser.content.p; while (parser.content.p < parser.content.end) { cp = peek_char(&parser.content, -1); c = peek_char(&parser.content, 0); @@ -577,7 +577,7 @@ int ndb_parse_content(unsigned char *buf, int buf_size, return 0; } - parser.blocks->blocks_size = parser.buffer.p - blocks_start; + parser.blocks->blocks_size = parser.buffer.p - parser.buffer.start; // // pad to 8-byte alignment