summaryrefslogtreecommitdiff
path: root/source4/lib/registry
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2004-04-12 18:02:54 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 12:51:15 -0500
commit4019324f7633c029c3cf461ed8d15433fc7609ea (patch)
tree8056d38f769b8cc61850c0784b076c847089861a /source4/lib/registry
parent49d54f0298de9dcee8d0fcb7e193429b80a8c8b1 (diff)
downloadsamba-4019324f7633c029c3cf461ed8d15433fc7609ea.tar.gz
samba-4019324f7633c029c3cf461ed8d15433fc7609ea.tar.bz2
samba-4019324f7633c029c3cf461ed8d15433fc7609ea.zip
r182: Fix a couple of segfaults
(This used to be commit db5d7062e69b456a89b17525e5a0177f93c90c83)
Diffstat (limited to 'source4/lib/registry')
-rw-r--r--source4/lib/registry/TODO3
-rw-r--r--source4/lib/registry/common/reg_objects.c3
-rw-r--r--source4/lib/registry/common/reg_util.c4
-rw-r--r--source4/lib/registry/reg_backend_w95/reg_backend_w95.c4
4 files changed, 12 insertions, 2 deletions
diff --git a/source4/lib/registry/TODO b/source4/lib/registry/TODO
index f84b1c5339..9b0dbe4c71 100644
--- a/source4/lib/registry/TODO
+++ b/source4/lib/registry/TODO
@@ -4,6 +4,9 @@
reg_backend_dir:
- value support
+
+reg_backend_w95.c:
+ - write support
reg_backend_nt4:
- write support
diff --git a/source4/lib/registry/common/reg_objects.c b/source4/lib/registry/common/reg_objects.c
index 78260e198f..3f721c107e 100644
--- a/source4/lib/registry/common/reg_objects.c
+++ b/source4/lib/registry/common/reg_objects.c
@@ -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);
diff --git a/source4/lib/registry/common/reg_util.c b/source4/lib/registry/common/reg_util.c
index 5ca104fc2e..82b8d06679 100644
--- a/source4/lib/registry/common/reg_util.c
+++ b/source4/lib/registry/common/reg_util.c
@@ -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);
diff --git a/source4/lib/registry/reg_backend_w95/reg_backend_w95.c b/source4/lib/registry/reg_backend_w95/reg_backend_w95.c
index 0b6b6db358..31abd69854 100644
--- a/source4/lib/registry/reg_backend_w95/reg_backend_w95.c
+++ b/source4/lib/registry/reg_backend_w95/reg_backend_w95.c
@@ -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);