diff options
| author | Mattias Andrée <m@maandree.se> | 2026-05-16 10:47:00 +0200 |
|---|---|---|
| committer | Mattias Andrée <m@maandree.se> | 2026-05-16 10:47:00 +0200 |
| commit | dbffc7416c8463458d5049485fc838e33459089b (patch) | |
| tree | 65c508e7f6807db89b2fab1ed86ae0a489c4c2c6 /librecrypt_chain_length.c | |
| parent | Add WITH_LIBAR2SIMPLIFIED=false + work on fuzzing code (diff) | |
| download | librecrypt-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 '')
| -rw-r--r-- | librecrypt_chain_length.c | 9 |
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; } |
