Fix possible incomplete read bug on onion packet decode
authorValentine Wallace <vwallace@protonmail.com>
Tue, 12 Jul 2022 20:04:42 +0000 (16:04 -0400)
committerValentine Wallace <vwallace@protonmail.com>
Tue, 2 Aug 2022 23:19:39 +0000 (19:19 -0400)
commit17ec697f8f09d608f6a3d2703ed4f4409773b4bf
treef7b1db08376d8d0aaf3bf74dd7e6339a6d157d4e
parent39397d4e14ed87e62cf8f313de749b7b5785561e
Fix possible incomplete read bug on onion packet decode

Pre-existing to this PR, we were reading next packet bytes with io::Read::read,
which is not guaranteed to read all the bytes we need, only guaranteed to read
*some* bytes.

We fix this to be read_exact, which is guaranteed to read all the next hop
packet bytes.
lightning/src/ln/onion_utils.rs