matrix-rust-sdk-fuzz-target

git clone git://archive.git.mtrnord.blog/MTRNord/matrix-rust-sdk-fuzz-target.git
Log | Files | Refs | README

commit 00f39010f95af12cfbcae74a2858e985ed2daeb6
parent ff0100bdb53f6a7e72c3f1bfc9dbaab03087f7b1
Author: MTRNord <mtrnord1@gmail.com>
Date:   Mon, 28 Jun 2021 12:04:07 +0200

Fix code of get_room

Diffstat:
Msrc/get_room.rs | 10++++++----
1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/src/get_room.rs b/src/get_room.rs @@ -5,10 +5,12 @@ use url::Url; fn main() { afl::fuzz!(|data: &[u8]| { - if let Ok(url) = Url::parse("http://127.0.0.1") { - if let Ok(client) = Client::new(url) { - if let Ok(room_id) = RoomId::try_from(data) { - let _ = client.get_room(&room_id); + if let Ok(s) = std::str::from_utf8(data) { + if let Ok(url) = Url::parse("http://127.0.0.1") { + if let Ok(client) = Client::new(url) { + if let Ok(room_id) = RoomId::try_from(s) { + let _ = client.get_room(&room_id); + } } } }