Merge pull request #1795 from kext/msos-multisz-terminator

embassy-usb: Fixed the final null terminator for RegMultiSz.
This commit is contained in:
Dario Nieuwenhuis 2023-08-18 11:28:06 +00:00 committed by GitHub
commit 5329f234ba
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -526,7 +526,7 @@ impl<'a> PropertyData<'a> {
PropertyData::Binary(val) => val.len(), PropertyData::Binary(val) => val.len(),
PropertyData::DwordLittleEndian(val) | PropertyData::DwordBigEndian(val) => core::mem::size_of_val(val), PropertyData::DwordLittleEndian(val) | PropertyData::DwordBigEndian(val) => core::mem::size_of_val(val),
PropertyData::RegMultiSz(val) => { PropertyData::RegMultiSz(val) => {
core::mem::size_of::<u16>() * val.iter().map(|x| x.encode_utf16().count() + 1).sum::<usize>() + 1 core::mem::size_of::<u16>() * (val.iter().map(|x| x.encode_utf16().count() + 1).sum::<usize>() + 1)
} }
} }
} }