mirror of
https://github.com/aljazceru/lightning.git
synced 2026-01-07 16:14:26 +01:00
devtools/decodemsg: handle truncated TLVs properly.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
committed by
neil saitug
parent
50f8da85ac
commit
9f5f9e15d0
@@ -187,6 +187,11 @@ void printwire_tlvs(const char *fieldname, const u8 **cursor, size_t *plen,
|
||||
if (!*cursor)
|
||||
goto fail;
|
||||
|
||||
if (length > *plen) {
|
||||
*plen = 0;
|
||||
goto fail;
|
||||
}
|
||||
|
||||
ptype = find_print_record_type(type, types, num_types);
|
||||
if (ptype) {
|
||||
size_t tlvlen = length;
|
||||
@@ -195,9 +200,9 @@ void printwire_tlvs(const char *fieldname, const u8 **cursor, size_t *plen,
|
||||
if (!*cursor)
|
||||
goto fail;
|
||||
printf("}\n");
|
||||
*plen -= length;
|
||||
} else
|
||||
printf("**TYPE #%"PRIu64" UNKNOWN for TLV %s**\n", type, fieldname);
|
||||
*plen -= length;
|
||||
}
|
||||
return;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user