Fixed the final null terminator for RegMultiSz.

The RegMultiSz value should be terminated by an empty UTF-16 string, i.e. 2 null bytes.
This commit is contained in:
Lukas Joeressen 2023-08-18 13:09:27 +02:00
parent 94fa95c699
commit 91b10dd799

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)
} }
} }
} }