aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/modes/cfb
diff options
context:
space:
mode:
authorlloyd <lloyd@randombit.net>2014-01-18 23:30:03 +0000
committerlloyd <lloyd@randombit.net>2014-01-18 23:30:03 +0000
commit871a765023d21205a03e7906595bbee6dcc9c9e1 (patch)
tree7a0482d594d7862f4dbe3fdd0b202b40b75a0e63 /src/lib/modes/cfb
parentbb4a85e2ade6a17a2c3f2577f2c24210fb2b3af8 (diff)
Avoid memory overread in last block of CFB encryption.
Diffstat (limited to 'src/lib/modes/cfb')
-rw-r--r--src/lib/modes/cfb/cfb.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/lib/modes/cfb/cfb.cpp b/src/lib/modes/cfb/cfb.cpp
index 7721e1487..7b4aed3f0 100644
--- a/src/lib/modes/cfb/cfb.cpp
+++ b/src/lib/modes/cfb/cfb.cpp
@@ -99,7 +99,7 @@ void CFB_Encryption::update(secure_vector<byte>& buffer, size_t offset)
// Assumes feedback-sized block except for last input
copy_mem(&state[0], &state[shift], BS - shift);
- copy_mem(&state[BS-shift], &buf[0], shift);
+ copy_mem(&state[BS-shift], &buf[0], took);
cipher().encrypt(state, keystream_buf());
buf += took;