From 532ef0b9ac9156d752028dc1eb88c98a308a14a9 Mon Sep 17 00:00:00 2001 From: John Smith Date: Mon, 29 May 2023 12:26:36 -0400 Subject: [PATCH] fix bug when setting node id --- Cargo.lock | 2 ++ veilid-core/src/table_store/table_db.rs | 5 ++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/Cargo.lock b/Cargo.lock index 3f91cc56..32980e79 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1248,6 +1248,7 @@ dependencies = [ "ciborium", "clap 3.2.25", "criterion-plot", + "futures", "itertools", "lazy_static", "num-traits", @@ -2869,6 +2870,7 @@ dependencies = [ name = "keyvaluedb-web" version = "0.1.0" dependencies = [ + "async-lock", "console_log", "flume", "futures", diff --git a/veilid-core/src/table_store/table_db.rs b/veilid-core/src/table_store/table_db.rs index 7b90509e..0702a6de 100644 --- a/veilid-core/src/table_store/table_db.rs +++ b/veilid-core/src/table_store/table_db.rs @@ -125,7 +125,10 @@ impl TableDB { /// Decrypt buffer using decrypt key with nonce prepended to input fn maybe_decrypt(&self, data: &[u8]) -> Vec { if let Some(di) = &self.unlocked_inner.decrypt_info { - assert!(data.len() > NONCE_LENGTH); + assert!(data.len() >= NONCE_LENGTH); + if data.len() == NONCE_LENGTH { + return Vec::new(); + } let mut out = unsafe { unaligned_u8_vec_uninit(data.len() - NONCE_LENGTH) };