aboutsummaryrefslogtreecommitdiffstats
path: root/libhashsum_init_hasher_from_string.c
diff options
context:
space:
mode:
authorMattias Andrée <maandree@kth.se>2024-09-04 21:41:59 +0200
committerMattias Andrée <maandree@kth.se>2024-09-04 21:41:59 +0200
commit1a9ebda1a5294e91db3015d4536ce36f62ec7058 (patch)
treebc7118da36d7aadb25aab4feee8c460abf4148e8 /libhashsum_init_hasher_from_string.c
parentFix and test BLAKE2 support (diff)
downloadlibhashsum-1a9ebda1a5294e91db3015d4536ce36f62ec7058.tar.gz
libhashsum-1a9ebda1a5294e91db3015d4536ce36f62ec7058.tar.bz2
libhashsum-1a9ebda1a5294e91db3015d4536ce36f62ec7058.tar.xz
Add more BLAKE2 tests and fix keyed BLAKE2 support in libhashsum_init_hasher_from_string
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to '')
-rw-r--r--libhashsum_init_hasher_from_string.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/libhashsum_init_hasher_from_string.c b/libhashsum_init_hasher_from_string.c
index ffd23eb..e7a26d0 100644
--- a/libhashsum_init_hasher_from_string.c
+++ b/libhashsum_init_hasher_from_string.c
@@ -256,7 +256,10 @@ next:
if (*p++ != ']' || *p)
goto einval;
- r = initfunc(this, n, salti ? salt : NULL, pepperi ? pepper : NULL, key, keyi);
+ if (keyi > SIZE_MAX / 8U)
+ goto einval;
+
+ r = initfunc(this, n, salti ? salt : NULL, pepperi ? pepper : NULL, key, keyi * 8U);
free(key);
return r;