summaryrefslogtreecommitdiff
path: root/src/vrrpv2.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/vrrpv2.rs')
-rw-r--r--src/vrrpv2.rs4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/vrrpv2.rs b/src/vrrpv2.rs
index 9a8fc95..2277dd2 100644
--- a/src/vrrpv2.rs
+++ b/src/vrrpv2.rs
@@ -100,8 +100,8 @@ impl<T: AsRef<[u8]>> BytesReader for Cursor<T> {
impl VRRPv2 {
pub fn to_bytes(&self) -> Result<Vec<u8>, std::io::Error> {
- let sz = (4 + self.count_ip_addrs) * 4;
- let bytes: Vec<u8> = Vec::with_capacity(sz.into());
+ let sz = 16 + (self.ip_addrs.len() * 4);
+ let bytes: Vec<u8> = Vec::with_capacity(sz);
let mut wr = Cursor::new(bytes);
wr.write_all(
[