From 3bfaf792e62c93416210db26bada00490c48c0c1 Mon Sep 17 00:00:00 2001 From: Jakob Unterwurzacher Date: Wed, 19 Jul 2017 22:37:10 +0200 Subject: [PATCH] writeV6Config: cast booleans to int The tinyxml2 library used by Arch Linux represents booleans as "true" and "false" instead of "0" and "1". These fail to load when read back later and will always be interpreted as false, as seen in https://github.com/vgough/encfs/issues/343 . Cast the booleans to int to force representation as "0" and "1" in all tinyxml2 variants. --- encfs/FileUtils.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/encfs/FileUtils.cpp b/encfs/FileUtils.cpp index e1b659c..f3a3eb8 100644 --- a/encfs/FileUtils.cpp +++ b/encfs/FileUtils.cpp @@ -536,12 +536,12 @@ bool writeV6Config(const char *configFile, const EncFSConfig *cfg) { addEl(doc, config, "nameAlg", cfg->nameIface); addEl(doc, config, "keySize", cfg->keySize); addEl(doc, config, "blockSize", cfg->blockSize); - addEl(doc, config, "uniqueIV", cfg->uniqueIV); - addEl(doc, config, "chainedNameIV", cfg->chainedNameIV); - addEl(doc, config, "externalIVChaining", cfg->externalIVChaining); + addEl(doc, config, "uniqueIV", (int)cfg->uniqueIV); + addEl(doc, config, "chainedNameIV", (int)cfg->chainedNameIV); + addEl(doc, config, "externalIVChaining", (int)cfg->externalIVChaining); addEl(doc, config, "blockMACBytes", cfg->blockMACBytes); addEl(doc, config, "blockMACRandBytes", cfg->blockMACRandBytes); - addEl(doc, config, "allowHoles", cfg->allowHoles); + addEl(doc, config, "allowHoles", (int)cfg->allowHoles); addEl(doc, config, "encodedKeySize", (int)cfg->keyData.size()); addEl(doc, config, "encodedKeyData", cfg->keyData); addEl(doc, config, "saltLen", (int)cfg->salt.size());