s4/registry - Patch for REGF backend

Matthias Dieter Wallnöfer mdw at samba.org
Thu Apr 8 06:56:28 MDT 2010


Hi Jelmer,

a proposal how to fix the REGF backend format regarding REG_DWORD values.

Matthias

diff --git a/source4/lib/registry/regf.c b/source4/lib/registry/regf.c
index 615389e..6f6d079 100644
--- a/source4/lib/registry/regf.c
+++ b/source4/lib/registry/regf.c
@@ -1822,8 +1822,11 @@ static WERROR regf_set_value(struct hive_key 
*key, const
         /* Set the type and data */
         vk.data_length = data.length;
         vk.data_type = type;
-       if ((data.length == sizeof(uint32_t)) &&
-           ((type == REG_DWORD) || (type == REG_DWORD_BIG_ENDIAN))) {
+       if ((type == REG_DWORD) || (type == REG_DWORD_BIG_ENDIAN)) {
+               if (vk.data_length != sizeof(uint32_t)) {
+                       DEBUG(0, ("DWORD or DWORD_BIG_ENDIAN value with 
size other than 4 Byte!\n"));
+                       return WERR_GENERAL_FAILURE;
+               }
                 vk.data_length |= 0x80000000;
                 vk.data_offset = IVAL(data.data, 0);
         } else {



More information about the samba-technical mailing list