summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Schneider <asn@samba.org>2013-02-25 17:16:45 +0100
committerDavid Disseldorp <ddiss@suse.de>2013-03-05 23:30:11 +0100
commit7a50f089e0ae70ec7652575e11fbf87a9f6a86e7 (patch)
treec9bebe8b0e7b81d869c426b9f5b2b80580b10074
parent17424588c5d7b7dd1cda5eb6ca0d7d13524b963a (diff)
downloadsamba-7a50f089e0ae70ec7652575e11fbf87a9f6a86e7.tar.gz
samba-7a50f089e0ae70ec7652575e11fbf87a9f6a86e7.tar.bz2
samba-7a50f089e0ae70ec7652575e11fbf87a9f6a86e7.zip
s4-libregistry: Improve NULL handling of name.
Reviewed-by: David Disseldorp <ddiss@samba.org>
-rw-r--r--source4/lib/registry/regf.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/source4/lib/registry/regf.c b/source4/lib/registry/regf.c
index 06476b940e..544dbb0b1c 100644
--- a/source4/lib/registry/regf.c
+++ b/source4/lib/registry/regf.c
@@ -1892,13 +1892,14 @@ static WERROR regf_set_value(struct hive_key *key, const char *name,
/* If it's new, create the vk struct, if it's old, free the old data. */
if (old_vk_offset == -1) {
vk.header = "vk";
- vk.name_length = strlen(name);
- if (name != NULL && name[0] != 0) {
+ if (name != NULL && name[0] != '\0') {
vk.flag = 1;
vk.data_name = name;
+ vk.name_length = strlen(name);
} else {
- vk.data_name = NULL;
vk.flag = 0;
+ vk.data_name = NULL;
+ vk.name_length = 0;
}
} else {
/* Free data, if any */