[Reproducible-commits] [disorderfs] 01/01: Use ints in config struct instead of bools

Andrew Ayer agwa at andrewayer.name
Tue Dec 22 21:45:44 UTC 2015


This is an automated email from the git hooks/post-receive script.

agwa-guest pushed a commit to branch master
in repository disorderfs.

commit 37fcff55262c495a3e2fc53cfbecf5c902a28573
Author: Andrew Ayer <agwa at andrewayer.name>
Date:   Tue Dec 22 13:27:08 2015 -0800

    Use ints in config struct instead of bools
    
    fuse_opt_parse expects the struct fields to be ints.  When bools
    are used, fuse_opt_parse writes beyond the field, clobbering
    other fields or even writing beyond the boundary of the struct!
    
    This error was not detected by the compiler because fuse_opt_parse does
    not have a type-safe API :-(
    
    Closes: #808779
---
 disorderfs.cpp | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/disorderfs.cpp b/disorderfs.cpp
index e209181..4e61e84 100644
--- a/disorderfs.cpp
+++ b/disorderfs.cpp
@@ -48,11 +48,13 @@ namespace {
 	std::vector<std::string>	bare_arguments;
 	std::string			root;
 	struct Disorderfs_config {
-		bool			multi_user{false};
-		bool			shuffle_dirents{false};
-		bool			reverse_dirents{true};
-		unsigned int		pad_blocks{1};
-		bool			share_locks{false};
+		// ATTENTION! Members of this struct MUST be ints, even the booleans, because
+		// that's what fuse_opt_parse expects.  Take heed or you will get memory corruption!
+		int			multi_user{0};
+		int			shuffle_dirents{0};
+		int			reverse_dirents{1};
+		int			pad_blocks{1};
+		int			share_locks{0};
 	};
 	Disorderfs_config		config;
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/reproducible/disorderfs.git



More information about the Reproducible-commits mailing list