aboutsummaryrefslogtreecommitdiffstats
path: root/librecrypt_chain_length.c
diff options
context:
space:
mode:
authorMattias Andrée <m@maandree.se>2026-05-16 10:47:00 +0200
committerMattias Andrée <m@maandree.se>2026-05-16 10:47:00 +0200
commitdbffc7416c8463458d5049485fc838e33459089b (patch)
tree65c508e7f6807db89b2fab1ed86ae0a489c4c2c6 /librecrypt_chain_length.c
parentAdd WITH_LIBAR2SIMPLIFIED=false + work on fuzzing code (diff)
downloadlibrecrypt-dbffc7416c8463458d5049485fc838e33459089b.tar.gz
librecrypt-dbffc7416c8463458d5049485fc838e33459089b.tar.bz2
librecrypt-dbffc7416c8463458d5049485fc838e33459089b.tar.xz
Fix fuzzing code
Signed-off-by: Mattias Andrée <m@maandree.se>
Diffstat (limited to 'librecrypt_chain_length.c')
-rw-r--r--librecrypt_chain_length.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/librecrypt_chain_length.c b/librecrypt_chain_length.c
index 364186a..adde62a 100644
--- a/librecrypt_chain_length.c
+++ b/librecrypt_chain_length.c
@@ -39,8 +39,13 @@ volatile size_t discarded_return_value;
int
LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
{
- (void) size;
- discarded_return_value = librecrypt_chain_length((const void *)data);
+ char *hash;
+ hash = malloc(size + 1u);
+ assert(hash);
+ memcpy(hash, data, size);
+ hash[size] = '\0';
+ discarded_return_value = librecrypt_chain_length(hash);
+ free(hash);
return 0;
}