summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Rettberg2024-04-23 12:20:00 +0200
committerSimon Rettberg2024-04-23 12:20:00 +0200
commite0e4d749d9f317c56ad4c8c61f08f4aeddf94882 (patch)
treed14fe1eb5b6f5d4e089cad2186cfa4ef0607e8f5
parent[FUSE] Fix use-after-free of curl_slist; unify init code (diff)
downloaddnbd3-e0e4d749d9f317c56ad4c8c61f08f4aeddf94882.tar.gz
dnbd3-e0e4d749d9f317c56ad4c8c61f08f4aeddf94882.tar.xz
dnbd3-e0e4d749d9f317c56ad4c8c61f08f4aeddf94882.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 ) {