mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-01-18 21:35:11 +01:00
devtools/decodemsg: don't crash if we have multiple tlv options.
We call tal_count(msg) after we've moved msg, and that causes an abort. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
parent
d2165ff4d8
commit
11c21f97a6
@ -138,9 +138,8 @@ ${print_fieldset(msg.fields.values(), False, '&cursor', '&plen')}
|
|||||||
|
|
||||||
void print${options.enum_name}_tlv_message(const char *tlv_name, const u8 *msg) {
|
void print${options.enum_name}_tlv_message(const char *tlv_name, const u8 *msg) {
|
||||||
% if bool(tlvs):
|
% if bool(tlvs):
|
||||||
size_t plen;
|
size_t plen = tal_count(msg);
|
||||||
% for tlv_name in tlvs:
|
% for tlv_name in tlvs:
|
||||||
plen = tal_count(msg);
|
|
||||||
if (strcmp(tlv_name, "${tlv_name}") == 0) {
|
if (strcmp(tlv_name, "${tlv_name}") == 0) {
|
||||||
printwire_tlvs(tlv_name, &msg, &plen, print_tlvs_${tlv_name}, ARRAY_SIZE(print_tlvs_${tlv_name}));
|
printwire_tlvs(tlv_name, &msg, &plen, print_tlvs_${tlv_name}, ARRAY_SIZE(print_tlvs_${tlv_name}));
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user