From 91b10dd79912b92de5b16a2ea6e2769876fe13fa Mon Sep 17 00:00:00 2001 From: Lukas Joeressen Date: Fri, 18 Aug 2023 13:09:27 +0200 Subject: [PATCH] Fixed the final null terminator for RegMultiSz. The RegMultiSz value should be terminated by an empty UTF-16 string, i.e. 2 null bytes. --- embassy-usb/src/msos.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/embassy-usb/src/msos.rs b/embassy-usb/src/msos.rs index 187b2ff8..847338e5 100644 --- a/embassy-usb/src/msos.rs +++ b/embassy-usb/src/msos.rs @@ -526,7 +526,7 @@ impl<'a> PropertyData<'a> { PropertyData::Binary(val) => val.len(), PropertyData::DwordLittleEndian(val) | PropertyData::DwordBigEndian(val) => core::mem::size_of_val(val), PropertyData::RegMultiSz(val) => { - core::mem::size_of::() * val.iter().map(|x| x.encode_utf16().count() + 1).sum::() + 1 + core::mem::size_of::() * (val.iter().map(|x| x.encode_utf16().count() + 1).sum::() + 1) } } }