Correct MAX_BUF_SIZE in serialization 2018-09-ser-fixes
authorMatt Corallo <git@bluematt.me>
Wed, 12 Sep 2018 17:21:13 +0000 (13:21 -0400)
committerMatt Corallo <git@bluematt.me>
Wed, 12 Sep 2018 17:22:42 +0000 (13:22 -0400)
I think this might have been my fault due to faulty review
feedback, but fuzzer caught trivial crash here where you try to
send a ping message larger than 16KB (but smaller than the
max-length 64KB) and you crash as message serialization is unwrap()

src/util/ser.rs

index 1944519d05316186f3bec612ac8d5b8612523e0c..299515d9022ed46341754d2eca417a5f48f85fce 100644 (file)
@@ -13,7 +13,7 @@ use ln::msgs::DecodeError;
 
 use util::byte_utils::{be64_to_array, be32_to_array, be16_to_array, slice_to_be16, slice_to_be32, slice_to_be64};
 
-const MAX_BUF_SIZE: usize = 16 * 1024;
+const MAX_BUF_SIZE: usize = 64 * 1024;
 
 pub struct Writer<W> { writer: W }
 pub struct Reader<R> { reader: R }