summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Rettberg2024-04-23 12:20:00 +0200
committerSimon Rettberg2024-05-13 18:26:42 +0200
commit629d240ec364c6006aee823bcf9f2f0c5bc5945e (patch)
tree32fda7c8ff42e75ac43d3c56cbd2446b002009cf
parent[FUSE] Fix use-after-free of curl_slist; unify init code (diff)
downloaddnbd3-629d240ec364c6006aee823bcf9f2f0c5bc5945e.tar.gz
dnbd3-629d240ec364c6006aee823bcf9f2f0c5bc5945e.tar.xz
dnbd3-629d240ec364c6006aee823bcf9f2f0c5bc5945e.zip
[FUSE] Fix division by zero
-rw-r--r--src/cowtest/main.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/cowtest/main.c b/src/cowtest/main.c
index c7da4ac..dc2bac5 100644
--- a/src/cowtest/main.c
+++ b/src/cowtest/main.c
@@ -1061,7 +1061,7 @@ bool randomWriteTest( char *mountedImagePath, char *normalImagePath, float minS
off_t offset = rand() % maxOffset;
size_t size = ( rand() + offset ) % RND_MAX_WRITE_SIZE;
if ( size < RND_MAX_WRITE_SIZE / 2 ) {
- size /= rand() % 8192;
+ size /= 1 + ( rand() % 8192 );
}
size = MAX( size, 1 );
if ( r > RND_TRUNCATE_PROBABILITY + RND_UNALIGNED_WRITE_PROBABILITY ) {