summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source4/lib/registry/ldb.c3
-rw-r--r--source4/lib/registry/patchfile_preg.c4
-rw-r--r--source4/lib/registry/regf.c2
-rw-r--r--source4/lib/registry/util.c7
4 files changed, 9 insertions, 7 deletions
diff --git a/source4/lib/registry/ldb.c b/source4/lib/registry/ldb.c
index 033fdcb780..d70489ac03 100644
--- a/source4/lib/registry/ldb.c
+++ b/source4/lib/registry/ldb.c
@@ -80,7 +80,8 @@ static void reg_ldb_unpack_value(TALLOC_CTX *mem_ctx,
case REG_DWORD: {
uint32_t tmp = strtoul((char *)val->data, NULL, 0);
- *data = data_blob_talloc(mem_ctx, &tmp, 4);
+ *data = data_blob_talloc(mem_ctx, NULL, 4);
+ SIVAL(data->data, 0, tmp);
}
break;
diff --git a/source4/lib/registry/patchfile_preg.c b/source4/lib/registry/patchfile_preg.c
index 30a9aea2a5..d7b4bc3730 100644
--- a/source4/lib/registry/patchfile_preg.c
+++ b/source4/lib/registry/patchfile_preg.c
@@ -109,7 +109,7 @@ static WERROR reg_preg_diff_del_value(void *_data, const char *key_name,
val = talloc_asprintf(data->ctx, "**Del.%s", value_name);
blob.data = (uint8_t *)talloc(data->ctx, uint32_t);
- *(uint32_t *)blob.data = 0;
+ SIVAL(blob.data, 0, 0);
blob.length = 4;
return reg_preg_diff_set_value(data, key_name, val, REG_DWORD, blob);
}
@@ -120,7 +120,7 @@ static WERROR reg_preg_diff_del_all_values(void *_data, const char *key_name)
DATA_BLOB blob;
blob.data = (uint8_t *)talloc(data->ctx, uint32_t);
- *(uint32_t *)blob.data = 0;
+ SIVAL(blob.data, 0, 0);
blob.length = 4;
return reg_preg_diff_set_value(data, key_name, "**DelVals.", REG_DWORD, blob);
diff --git a/source4/lib/registry/regf.c b/source4/lib/registry/regf.c
index a96c7db0ee..b5b676f9d8 100644
--- a/source4/lib/registry/regf.c
+++ b/source4/lib/registry/regf.c
@@ -1816,7 +1816,7 @@ static WERROR regf_set_value(struct hive_key *key, const char *name,
vk.data_type = type;
if (type == REG_DWORD) {
vk.data_length |= 0x80000000;
- vk.data_offset = *(uint32_t *)data.data;
+ vk.data_offset = IVAL(data.data, 0);
} else {
/* Store data somewhere */
vk.data_offset = hbin_store(regf, data);
diff --git a/source4/lib/registry/util.c b/source4/lib/registry/util.c
index 5d451df33a..ba739c4921 100644
--- a/source4/lib/registry/util.c
+++ b/source4/lib/registry/util.c
@@ -75,11 +75,11 @@ _PUBLIC_ char *reg_val_data_string(TALLOC_CTX *mem_ctx,
ret = data_blob_hex_string_upper(mem_ctx, &data);
break;
case REG_DWORD:
- if (*(int *)data.data == 0) {
+ if (IVAL(data.data, 0) == 0) {
ret = talloc_strdup(mem_ctx, "0");
} else {
ret = talloc_asprintf(mem_ctx, "0x%x",
- *(int *)data.data);
+ IVAL(data.data, 0));
}
break;
case REG_NONE:
@@ -147,7 +147,8 @@ _PUBLIC_ bool reg_string_to_val(TALLOC_CTX *mem_ctx,
break;
case REG_DWORD: {
uint32_t tmp = strtol(data_str, NULL, 0);
- *data = data_blob_talloc(mem_ctx, &tmp, 4);
+ *data = data_blob_talloc(mem_ctx, NULL, 4);
+ SIVAL(data->data, 0, tmp);
}
break;
case REG_NONE: