[fuzz] Fix slice copy in `peer_crypt_target` 2023-12-arbitrary-fuzz-config
authorMatt Corallo <git@bluematt.me>
Wed, 31 Jan 2024 19:48:44 +0000 (19:48 +0000)
committerMatt Corallo <git@bluematt.me>
Fri, 2 Feb 2024 18:05:09 +0000 (18:05 +0000)
This has apparently been broken for quite some time...I guess
`peer_crypt_target` doesn't get much CPU anymore.

fuzz/src/peer_crypt.rs

index 3acf4d664f66e7f150ba6b2fd279f9c39ebd02ad..41d8c0936060868a97df54711f725e397ea3a35d 100644 (file)
@@ -83,7 +83,7 @@ pub fn do_test(data: &[u8]) {
                                Ok(len) => len,
                                Err(_) => return,
                        };
-                       buf.copy_from_slice(&get_slice!(len as usize + 16));
+                       buf[..len as usize + 16].copy_from_slice(&get_slice!(len as usize + 16));
                        match crypter.decrypt_message(&mut buf[..len as usize + 16]) {
                                Ok(_) => {},
                                Err(_) => return,