From 8b2342e3889ac3cfefb226e7c6ef7d47a432059a Mon Sep 17 00:00:00 2001 From: Mike Dilger Date: Tue, 21 Jan 2025 08:59:06 +1300 Subject: [PATCH] Fix indexing issue (since outpos was 0 it wasn't actually a bug yet) --- src/nostr.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/nostr.rs b/src/nostr.rs index 3b20711..1861afe 100644 --- a/src/nostr.rs +++ b/src/nostr.rs @@ -56,7 +56,8 @@ impl WebSocketService { verify_char(input, b'"', &mut inpos)?; let (inlen, outlen) = json_unescape(&input[inpos..], &mut self.buffer[outpos..])?; inpos += inlen; - let subid = unsafe { String::from_utf8_unchecked(self.buffer[outpos..outlen].to_owned()) }; + let subid = + unsafe { String::from_utf8_unchecked(self.buffer[outpos..outpos + outlen].to_owned()) }; outpos += outlen; verify_char(input, b'"', &mut inpos)?; // FIXME: json_unescape should eat the closing quote