transaction: Fix fetch_object result slicing
Needs to match the original C code:
memmove(data, data + 1 + offs, outlen);
This commit is contained in:
+4
-4
@@ -489,7 +489,7 @@ impl<'tx> Transaction<'tx> {
|
|||||||
return Err(Error::GenericError);
|
return Err(Error::GenericError);
|
||||||
}
|
}
|
||||||
|
|
||||||
let mut data = response.into_buffer();
|
let data = response.into_buffer();
|
||||||
let mut outlen = 0;
|
let mut outlen = 0;
|
||||||
|
|
||||||
if data.len() < 2 || !has_valid_length(&data[1..], data.len() - 1) {
|
if data.len() < 2 || !has_valid_length(&data[1..], data.len() - 1) {
|
||||||
@@ -512,9 +512,9 @@ impl<'tx> Transaction<'tx> {
|
|||||||
return Err(Error::SizeError);
|
return Err(Error::SizeError);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Remove the length tag
|
Ok(Zeroizing::new(
|
||||||
data.remove(0);
|
data[(1 + offs)..(1 + offs + outlen)].to_vec(),
|
||||||
Ok(data)
|
))
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Save an object
|
/// Save an object
|
||||||
|
|||||||
Reference in New Issue
Block a user