mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-20 07:34:24 +01:00
gossip: Fix a memcmp with unset memory in broadcast queue
`tal_fmt` overallocates the returned string under some circumstances, meaning that the trailer of the formatted string is unset, but still considered in `tal_len`. The solution then is to truncate the formatted string to the real string length. Only necessary here, since we mix strings and `tal_len`. Signed-off-by: Christian Decker <decker.christian@gmail.com>
This commit is contained in:
committed by
Rusty Russell
parent
4fe83cd405
commit
3a42e52bcd
@@ -554,6 +554,7 @@ const struct short_channel_id *handle_channel_announcement(
|
||||
|
||||
tag = type_to_string(pending, struct short_channel_id,
|
||||
&pending->short_channel_id);
|
||||
tal_resize(&tag, strlen(tag));
|
||||
|
||||
/* BOLT #7:
|
||||
*
|
||||
@@ -635,6 +636,7 @@ bool handle_pending_cannouncement(struct routing_state *rstate,
|
||||
list_del_from(&rstate->pending_cannouncement, &pending->list);
|
||||
|
||||
tag = type_to_string(pending, struct short_channel_id, scid);
|
||||
tal_resize(&tag, strlen(tag));
|
||||
|
||||
/* BOLT #7:
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user