the size of the command pkt was overflowing urwejrfklweqjflkqw
This commit is contained in:
parent
9423b29ab5
commit
cbb80df311
@ -447,7 +447,7 @@ fn generate_psomessage_impl(msg_cmd: u8, name: syn::Ident, attrs: &Vec<AttrType>
|
|||||||
|
|
||||||
let mut fullbuf = Vec::new();
|
let mut fullbuf = Vec::new();
|
||||||
fullbuf.push(#msg_cmd);
|
fullbuf.push(#msg_cmd);
|
||||||
fullbuf.push((buf.len() as u8 + 2) / 4);
|
fullbuf.push(((buf.len() + 2) / 4) as u8);
|
||||||
fullbuf.extend_from_slice(&mut buf);
|
fullbuf.extend_from_slice(&mut buf);
|
||||||
|
|
||||||
fullbuf
|
fullbuf
|
||||||
|
17
src/lib.rs
17
src/lib.rs
@ -528,4 +528,21 @@ mod test {
|
|||||||
c: 5,
|
c: 5,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_pso_message_overflow() {
|
||||||
|
#[pso_message(0x23)]
|
||||||
|
struct Test {
|
||||||
|
b: [u32; 100],
|
||||||
|
};
|
||||||
|
|
||||||
|
let test = Test {
|
||||||
|
client: 1,
|
||||||
|
target: 2,
|
||||||
|
b: [23; 100],
|
||||||
|
};
|
||||||
|
|
||||||
|
let bytes = test.as_bytes();
|
||||||
|
assert!(bytes[1] == 101);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user