Skip to content

Commit 40b9560

Browse files
committed
HASH_PROCESS: fix overflow test
state_var.length counts bits, inlen is in bytes.
1 parent 3f1b687 commit 40b9560

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/headers/tomcrypt_private.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ int func_name (hash_state * md, const unsigned char *in, unsigned long inlen)
9090
if (md-> state_var .curlen > sizeof(md-> state_var .buf)) { \
9191
return CRYPT_INVALID_ARG; \
9292
} \
93-
if ((md-> state_var .length + inlen) < md-> state_var .length) { \
93+
if ((md-> state_var .length + inlen * 8) < md-> state_var .length) { \
9494
return CRYPT_HASH_OVERFLOW; \
9595
} \
9696
while (inlen > 0) { \

0 commit comments

Comments
 (0)