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_next_algorithm.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_next_algorithm.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/librecrypt_next_algorithm.c b/librecrypt_next_algorithm.c index 831f52e..623a19b 100644 --- a/librecrypt_next_algorithm.c +++ b/librecrypt_next_algorithm.c @@ -92,19 +92,22 @@ main(void) int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { - char *hash, *r; - size_t sum = 0u; + char *hash, *orig, *r; + size_t sum = 0u, len; hash = malloc(size + 1u); assert(hash); + orig = hash; memcpy(hash, data, size); hash[size] = '\0'; + len = strlen(hash); for (;;) { r = librecrypt_next_algorithm(&hash); if (!r) break; sum += strlen(r) + 1u; } - EXPECT(sum == size + 1u); + EXPECT(sum == len + 1u); + free(orig); return 0; } |
