diff --git a/src/sieve-bin/bin-common.c b/src/sieve-bin/bin-common.c
index 7deb5dd6a7af74fbdbb1550e53d4ac6c1e806dbb..98e3b363961b234b09dba40fc28e9917924f0dc9 100644
--- a/src/sieve-bin/bin-common.c
+++ b/src/sieve-bin/bin-common.c
@@ -116,7 +116,7 @@ void bin_dump_sieve_binary_to(struct sieve_binary *sbin, const char *filename)
 	if ( strcmp(filename, "-") == 0 ) 
 		dumpstream = o_stream_create_fd(1, 0, FALSE);
 	else {
-		if ( (dfd = open(filename, O_WRONLY | O_CREAT)) < 0 ) {
+		if ( (dfd = open(filename, O_WRONLY | O_TRUNC | O_CREAT, 0600)) < 0 ) {
 			i_fatal("Failed to open dump-file for writing: %m");
 			exit(1);
 		}
diff --git a/src/testsuite/testsuite.c b/src/testsuite/testsuite.c
index 986de73a136c650c15ecdaa9ead74613743aa20b..f31d2de072d0f368ca33bbb2e33f3cd62b195bb5 100644
--- a/src/testsuite/testsuite.c
+++ b/src/testsuite/testsuite.c
@@ -119,7 +119,7 @@ static void _dump_sieve_binary_to(struct sieve_binary *sbin, const char *filenam
 	if ( strcmp(filename, "-") == 0 ) 
 		dumpstream = o_stream_create_fd(1, 0, FALSE);
 	else {
-		if ( (dfd = open(filename, O_WRONLY | O_CREAT)) < 0 ) {
+		if ( (dfd = open(filename, O_WRONLY | O_TRUNC | O_CREAT, 0600)) < 0 ) {
 			i_fatal("Failed to open dump-file for writing: %m");
 			exit(1);
 		}