mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-03-01 09:40:19 +01:00
gossipd: check that we don't try to access a deleted gossip entry.
We ignored this before, which meant that the DEVELOPER-mode check that we delete the correct record didn't check that it wasn't already deleted. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
parent
0edc0ae5e9
commit
f9ecc76d99
1 changed files with 7 additions and 2 deletions
|
@ -544,8 +544,13 @@ const u8 *gossip_store_get(const tal_t *ctx,
|
|||
offset, gs->len, strerror(errno));
|
||||
}
|
||||
|
||||
/* FIXME: We should skip over these deleted entries! */
|
||||
msglen = be32_to_cpu(hdr.len) & ~GOSSIP_STORE_LEN_DELETED_BIT;
|
||||
if (be32_to_cpu(hdr.len) & GOSSIP_STORE_LEN_DELETED_BIT)
|
||||
status_failed(STATUS_FAIL_INTERNAL_ERROR,
|
||||
"gossip_store: get delete entry offset %"PRIu64
|
||||
"/%"PRIu64"",
|
||||
offset, gs->len);
|
||||
|
||||
msglen = be32_to_cpu(hdr.len);
|
||||
checksum = be32_to_cpu(hdr.crc);
|
||||
msg = tal_arr(ctx, u8, msglen);
|
||||
if (pread(gs->fd, msg, msglen, offset + sizeof(hdr)) != msglen)
|
||||
|
|
Loading…
Add table
Reference in a new issue