summaryrefslogtreecommitdiff
path: root/source4/lib
diff options
context:
space:
mode:
authorMatthias Dieter Wallnöfer <mwallnoefer@yahoo.de>2010-03-14 17:40:14 +0100
committerMatthias Dieter Wallnöfer <mwallnoefer@yahoo.de>2010-03-14 18:46:23 +0100
commiteb8c8a0ecaa9bfd29f090db21fccdad7751767ae (patch)
tree8c2f14c9b6c27cd3c223f244f193d9d6e41431bc /source4/lib
parent508c218eb2f4bf8c45dc9d481576c87ed4fecbd3 (diff)
downloadsamba-eb8c8a0ecaa9bfd29f090db21fccdad7751767ae.tar.gz
samba-eb8c8a0ecaa9bfd29f090db21fccdad7751767ae.tar.bz2
samba-eb8c8a0ecaa9bfd29f090db21fccdad7751767ae.zip
s4:registry - util.c - add harder checks for inputs on "reg_val_data_string"
("NULL" result is error on most data types).
Diffstat (limited to 'source4/lib')
-rw-r--r--source4/lib/registry/util.c28
1 files changed, 16 insertions, 12 deletions
diff --git a/source4/lib/registry/util.c b/source4/lib/registry/util.c
index 7da53d381d..6ff61942f9 100644
--- a/source4/lib/registry/util.c
+++ b/source4/lib/registry/util.c
@@ -71,23 +71,27 @@ _PUBLIC_ char *reg_val_data_string(TALLOC_CTX *mem_ctx,
switch (type) {
case REG_EXPAND_SZ:
case REG_SZ:
- convert_string_talloc_convenience(mem_ctx,
- iconv_convenience,
- CH_UTF16, CH_UNIX,
- data.data,
- data.length,
- (void **)&ret,
- NULL, false);
+ if (data.length % 2 == 0) {
+ convert_string_talloc_convenience(mem_ctx,
+ iconv_convenience,
+ CH_UTF16, CH_UNIX,
+ data.data,
+ data.length,
+ (void **)&ret,
+ NULL, false);
+ }
break;
case REG_BINARY:
ret = data_blob_hex_string_upper(mem_ctx, &data);
break;
case REG_DWORD:
- if (IVAL(data.data, 0) == 0) {
- ret = talloc_strdup(mem_ctx, "0");
- } else {
- ret = talloc_asprintf(mem_ctx, "0x%x",
- IVAL(data.data, 0));
+ if (data.length == sizeof(uint32_t)) {
+ if (IVAL(data.data, 0) == 0) {
+ ret = talloc_strdup(mem_ctx, "0");
+ } else {
+ ret = talloc_asprintf(mem_ctx, "0x%x",
+ IVAL(data.data, 0));
+ }
}
break;
case REG_NONE: