mirror of
https://github.com/samba-team/samba.git
synced 2024-12-28 07:21:54 +03:00
s4:registry - ldb.c - fix up the memory handling in "reg_ldb_unpack_value"
Don't substitute existing data blobs with new ones and make sure, that the result objects in the data blob don't have memory dependencies of the LDB value input.
This commit is contained in:
parent
33eb1c95e5
commit
f72790daaa
@ -73,8 +73,11 @@ static void reg_ldb_unpack_value(TALLOC_CTX *mem_ctx,
|
||||
case REG_DWORD:
|
||||
if (val != NULL) {
|
||||
uint32_t tmp = strtoul((char *)val->data, NULL, 0);
|
||||
*data = data_blob_talloc(mem_ctx, NULL, 4);
|
||||
SIVAL(data->data, 0, tmp);
|
||||
data->data = talloc_size(mem_ctx, sizeof(uint32_t) + 1);
|
||||
if (data->data != NULL) {
|
||||
SIVAL(data->data, 0, tmp);
|
||||
}
|
||||
data->length = sizeof(uint32_t);
|
||||
} else {
|
||||
data->data = NULL;
|
||||
data->length = 0;
|
||||
@ -84,7 +87,9 @@ static void reg_ldb_unpack_value(TALLOC_CTX *mem_ctx,
|
||||
case REG_BINARY:
|
||||
default:
|
||||
if (val != NULL) {
|
||||
*data = data_blob_talloc(mem_ctx, val->data, val->length);
|
||||
data->data = talloc_memdup(mem_ctx, val->data,
|
||||
val->length);
|
||||
data->length = val->length;
|
||||
} else {
|
||||
data->data = NULL;
|
||||
data->length = 0;
|
||||
|
Loading…
Reference in New Issue
Block a user