mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-23 09:04:22 +01:00
wire: add fromwire_tal_arrn() helper.
Does the allocation and copying; this is useful because we can avoid being fooled into doing giant allocations. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
committed by
Christian Decker
parent
524d22e4cc
commit
c92e782e22
@@ -12,8 +12,8 @@ struct onionreply *fromwire_onionreply(const tal_t *ctx,
|
||||
const u8 **cursor, size_t *max)
|
||||
{
|
||||
struct onionreply *r = tal(ctx, struct onionreply);
|
||||
r->contents = tal_arr(r, u8, fromwire_u16(cursor, max));
|
||||
fromwire_u8_array(cursor, max, r->contents, tal_count(r->contents));
|
||||
r->contents = fromwire_tal_arrn(r, cursor, max,
|
||||
fromwire_u16(cursor, max));
|
||||
if (!*cursor)
|
||||
return tal_free(r);
|
||||
return r;
|
||||
|
||||
Reference in New Issue
Block a user