diff options
author | Matthias Dieter Wallnöfer <mwallnoefer@yahoo.de> | 2010-04-07 20:14:46 +0200 |
---|---|---|
committer | Matthias Dieter Wallnöfer <mwallnoefer@yahoo.de> | 2010-04-07 20:22:57 +0200 |
commit | 79fccc45bc3acac5d9b15a3585e2526a3b1876f2 (patch) | |
tree | e4b7498a2971bce86d2647bfc6f3adf17b24fd7d | |
parent | 8ae956d7ba23b10e8fe17facc19f44d0ab167762 (diff) | |
download | samba-79fccc45bc3acac5d9b15a3585e2526a3b1876f2.tar.gz samba-79fccc45bc3acac5d9b15a3585e2526a3b1876f2.tar.bz2 samba-79fccc45bc3acac5d9b15a3585e2526a3b1876f2.zip |
s4:registry - "regf backend" - fix it up regarding REG_DWORD/REG_DWORD_BIG_ENDIAN_VALUES
This is needed to make it platform independently work (also on big endian
platforms as little endian).
Also add a size check before storing a DWORD.
-rw-r--r-- | source4/lib/registry/regf.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/source4/lib/registry/regf.c b/source4/lib/registry/regf.c index 5825ac18a8..615389e0e8 100644 --- a/source4/lib/registry/regf.c +++ b/source4/lib/registry/regf.c @@ -550,10 +550,11 @@ static WERROR regf_get_value(TALLOC_CTX *ctx, struct hive_key *key, *data_type = vk->data_type; if (vk->data_length & 0x80000000) { - vk->data_length &=~0x80000000; - data->data = (uint8_t *)talloc_memdup(ctx, (uint8_t *)&vk->data_offset, vk->data_length); + /* this is data of type "REG_DWORD" or "REG_DWORD_BIG_ENDIAN" */ + data->data = talloc_size(ctx, sizeof(uint32_t)); W_ERROR_HAVE_NO_MEMORY(data->data); - data->length = vk->data_length; + SIVAL(data->data, 0, vk->data_offset); + data->length = sizeof(uint32_t); } else { *data = hbin_get(regf, vk->data_offset); } @@ -1821,7 +1822,8 @@ static WERROR regf_set_value(struct hive_key *key, const char *name, /* Set the type and data */ vk.data_length = data.length; vk.data_type = type; - if (type == REG_DWORD) { + if ((data.length == sizeof(uint32_t)) && + ((type == REG_DWORD) || (type == REG_DWORD_BIG_ENDIAN))) { vk.data_length |= 0x80000000; vk.data_offset = IVAL(data.data, 0); } else { |