mirror of
https://github.com/samba-team/samba.git
synced 2024-12-27 03:21:53 +03:00
r182: Fix a couple of segfaults
This commit is contained in:
parent
4d6ce64856
commit
db5d7062e6
@ -4,6 +4,9 @@
|
||||
|
||||
reg_backend_dir:
|
||||
- value support
|
||||
|
||||
reg_backend_w95.c:
|
||||
- write support
|
||||
|
||||
reg_backend_nt4:
|
||||
- write support
|
||||
|
@ -47,6 +47,9 @@ void reg_val_free( REG_VAL *val )
|
||||
if ( !val )
|
||||
return;
|
||||
|
||||
val->ref--;
|
||||
if(val->ref) return;
|
||||
|
||||
if(val->handle->functions->free_val_backend_data)
|
||||
val->handle->functions->free_val_backend_data(val);
|
||||
|
||||
|
@ -45,10 +45,10 @@ char *reg_val_data_string(REG_VAL *v)
|
||||
switch (reg_val_type(v)) {
|
||||
case REG_SZ:
|
||||
/* FIXME: Convert to ascii */
|
||||
return strdup(reg_val_data_blk(v));
|
||||
return strndup(reg_val_data_blk(v), reg_val_size(v));
|
||||
|
||||
case REG_EXPAND_SZ:
|
||||
return strdup(reg_val_data_blk(v));
|
||||
return strndup(reg_val_data_blk(v), reg_val_size(v));
|
||||
|
||||
case REG_BINARY:
|
||||
ret = malloc(reg_val_size(v) * 3 + 2);
|
||||
|
@ -204,6 +204,10 @@ static WERROR w95_get_subkey_by_index (REG_KEY *parent, int n, REG_KEY **key)
|
||||
RGDB_KEY *rgdb_key;
|
||||
char *name;
|
||||
rgdb_key = LOCN_RGDB_KEY(creg, child->id.rgdb, child->id.id);
|
||||
if(!rgdb_key) {
|
||||
DEBUG(0, ("Can't find %d,%d in RGDB table!\n", child->id.rgdb, child->id.id));
|
||||
return WERR_FOOBAR;
|
||||
}
|
||||
name = strndup((char *)rgdb_key + sizeof(RGDB_KEY), rgdb_key->name_len);
|
||||
*key = reg_key_new_rel(name, parent, child);
|
||||
SAFE_FREE(name);
|
||||
|
Loading…
Reference in New Issue
Block a user