mirror of
https://github.com/shadowsocks/shadowsocks-libev.git
synced 2026-10-23 08:03:54 +00:00
Fix decryption failed issue by nonce overwrite
If the first packet is less than nonce length, then the chunk nonce data will be overwrote by next packet and result in decrypt failed
This commit is contained in:
+1
-1
@@ -493,7 +493,7 @@ stream_decrypt(buffer_t *ciphertext, cipher_ctx_t *cipher_ctx, size_t capacity)
|
||||
ciphertext->len);
|
||||
|
||||
if (left_len > 0) {
|
||||
memcpy(cipher_ctx->chunk->data, ciphertext->data, left_len);
|
||||
memcpy(cipher_ctx->chunk->data + cipher_ctx->chunk->len, ciphertext->data, left_len);
|
||||
memmove(ciphertext->data, ciphertext->data + left_len,
|
||||
ciphertext->len - left_len);
|
||||
cipher_ctx->chunk->len += left_len;
|
||||
|
||||
Reference in New Issue
Block a user