Fix indexing issue (since outpos was 0 it wasn't actually a bug yet)

This commit is contained in:
Mike Dilger 2025-01-21 08:59:06 +13:00
parent fc939a530e
commit 8b2342e388
No known key found for this signature in database
GPG Key ID: 47581A78D4329BA4

View File

@ -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