Skip to content

Commit f5b8cc9

Browse files
committed
this should really implement a patch for the illegal access
1 parent 1a3880f commit f5b8cc9

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

src/hashes/blake2b.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,7 @@ int blake2b_process(hash_state *md, const unsigned char *in, unsigned long inlen
342342
unsigned long fill = BLAKE2B_BLOCKBYTES - left;
343343
if (inlen > fill) {
344344
md->blake2b.curlen = 0;
345-
XMEMCPY(md->blake2b.buf + left, in, fill); /* Fill buffer */
345+
XMEMCPY(md->blake2b.buf + (left % sizeof(md->blake2b.buf)), in, fill); /* Fill buffer */
346346
blake2b_increment_counter(md, BLAKE2B_BLOCKBYTES);
347347
blake2b_compress(md, md->blake2b.buf); /* Compress */
348348
in += fill;

src/hashes/blake2s.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,7 @@ int blake2s_process(hash_state *md, const unsigned char *in, unsigned long inlen
330330
unsigned long fill = BLAKE2S_BLOCKBYTES - left;
331331
if (inlen > fill) {
332332
md->blake2s.curlen = 0;
333-
XMEMCPY(md->blake2s.buf + left, in, fill); /* Fill buffer */
333+
XMEMCPY(md->blake2s.buf + (left % sizeof(md->blake2s.buf)), in, fill); /* Fill buffer */
334334
blake2s_increment_counter(md, BLAKE2S_BLOCKBYTES);
335335
blake2s_compress(md, md->blake2s.buf); /* Compress */
336336
in += fill;

0 commit comments

Comments
 (0)