diff --git a/zerotier-core-crypto/Cargo.toml b/zerotier-core-crypto/Cargo.toml index 74536d809..c0c502473 100644 --- a/zerotier-core-crypto/Cargo.toml +++ b/zerotier-core-crypto/Cargo.toml @@ -2,6 +2,8 @@ name = "zerotier-core-crypto" version = "0.1.0" edition = "2018" +license = "MPL-2.0" +authors = ["ZeroTier, Inc. ", "Adam Ierymenko "] [dependencies] rand_core = "0.5" diff --git a/zerotier-network-hypervisor/Cargo.toml b/zerotier-network-hypervisor/Cargo.toml index 9795ad065..205912d53 100644 --- a/zerotier-network-hypervisor/Cargo.toml +++ b/zerotier-network-hypervisor/Cargo.toml @@ -2,6 +2,8 @@ name = "zerotier-network-hypervisor" version = "2.0.0" edition = "2018" +license = "MPL-2.0" +authors = ["ZeroTier, Inc. ", "Adam Ierymenko "] [profile.release] lto = true diff --git a/zerotier-network-hypervisor/src/vl1/buffer.rs b/zerotier-network-hypervisor/src/vl1/buffer.rs index 660004d42..c7148a180 100644 --- a/zerotier-network-hypervisor/src/vl1/buffer.rs +++ b/zerotier-network-hypervisor/src/vl1/buffer.rs @@ -330,11 +330,17 @@ impl Buffer { /// Get the next variable length integer and advance the cursor by its length in bytes. #[inline(always)] pub fn read_varint(&self, cursor: &mut usize) -> std::io::Result { - let mut a = &self.1[*cursor..]; - crate::util::varint::read(&mut a).map(|r| { - *cursor += r.1; - r.0 - }) + let c = *cursor; + if c < self.0 { + let mut a = &self.1[c..]; + crate::util::varint::read(&mut a).map(|r| { + *cursor = c + r.1; + debug_assert!(*cursor < self.0); + r.0 + }) + } else { + Err(std::io::Error::new(std::io::ErrorKind::UnexpectedEof, OVERFLOW_ERR_MSG)) + } } /// Get the next u8 and advance the cursor. diff --git a/zerotier-system-service/Cargo.toml b/zerotier-system-service/Cargo.toml index 82ed0f8c4..49bd3e122 100644 --- a/zerotier-system-service/Cargo.toml +++ b/zerotier-system-service/Cargo.toml @@ -1,8 +1,9 @@ [package] name = "zerotier-system-service" version = "0.1.0" -authors = ["Adam Ierymenko "] +authors = ["ZeroTier, Inc. ", "Adam Ierymenko "] edition = "2018" +license = "MPL-2.0" [profile.release] opt-level = 'z' @@ -13,16 +14,16 @@ panic = 'abort' [dependencies] zerotier-network-hypervisor = { path = "../zerotier-network-hypervisor" } num_cpus = "^1" -tokio = { version = "1", features = ["rt", "net", "time", "signal", "macros"] } -serde = { version = "1", features = ["derive"] } +tokio = { version = "^1", features = ["rt", "net", "time", "signal", "macros"] } +serde = { version = "^1", features = ["derive"] } serde_json = "^1" -futures = "0" -clap = { version = "2", features = ["suggestions", "wrap_help"] } +futures = "^0" +clap = { version = "^2", features = ["suggestions", "wrap_help"] } chrono = "^0" lazy_static = "^1" num-traits = "^0" num-derive = "^0" -hyper = { version = "0", features = ["http1", "runtime", "server", "client", "tcp", "stream"] } +hyper = { version = "^0", features = ["http1", "runtime", "server", "client", "tcp", "stream"] } socket2 = { version = "^0", features = ["reuseport", "unix", "pair"] } dialoguer = "^0" digest_auth = "^0" diff --git a/zerotier-system-service/src/fastudpsocket.rs b/zerotier-system-service/src/fastudpsocket.rs index aaa976b5a..c971a28f7 100644 --- a/zerotier-system-service/src/fastudpsocket.rs +++ b/zerotier-system-service/src/fastudpsocket.rs @@ -48,8 +48,13 @@ fn bind_udp_socket(_device_name: &str, address: &InetAddress) -> Result