Revert "s4:registry/util - Don't include the trailing '\0' in the internal data forma...
authorMatthias Dieter Wallnöfer <mwallnoefer@yahoo.de>
Sun, 29 Nov 2009 13:42:31 +0000 (14:42 +0100)
committerMatthias Dieter Wallnöfer <mwallnoefer@yahoo.de>
Sun, 29 Nov 2009 13:51:50 +0000 (14:51 +0100)
This reverts commit 7d400715e9af2056690c03a1a2f45c7f343fa313.

"convert_string_talloc_convenience" does always add the NULL termination. Didn't
know that. Thanks Jelmer for pointing out!

source4/lib/registry/util.c

index 764660121f0c247eceb6463a35b93ae645ddeb6e..9409a8f4bc958482b166c3bcc4f07e9fa61a35a5 100644 (file)
@@ -56,7 +56,6 @@ _PUBLIC_ char *reg_val_data_string(TALLOC_CTX *mem_ctx,
                                   const DATA_BLOB data)
 {
        char *ret = NULL;
                                   const DATA_BLOB data)
 {
        char *ret = NULL;
-       size_t ret_cnt;
 
        if (data.length == 0)
                return talloc_strdup(mem_ctx, "");
 
        if (data.length == 0)
                return talloc_strdup(mem_ctx, "");
@@ -70,9 +69,7 @@ _PUBLIC_ char *reg_val_data_string(TALLOC_CTX *mem_ctx,
                                                          data.data,
                                                          data.length,
                                                          (void **)&ret,
                                                          data.data,
                                                          data.length,
                                                          (void **)&ret,
-                                                         &ret_cnt, false);
-                       ret = talloc_realloc(mem_ctx, ret, char, ret_cnt + 1);
-                       ret[ret_cnt] = '\0';
+                                                         NULL, false);
                        break;
                case REG_BINARY:
                        ret = data_blob_hex_string_upper(mem_ctx, &data);
                        break;
                case REG_BINARY:
                        ret = data_blob_hex_string_upper(mem_ctx, &data);
@@ -136,10 +133,9 @@ _PUBLIC_ bool reg_string_to_val(TALLOC_CTX *mem_ctx,
                                                          iconv_convenience,
                                                          CH_UNIX, CH_UTF16,
                                                          data_str,
                                                          iconv_convenience,
                                                          CH_UNIX, CH_UTF16,
                                                          data_str,
-                                                         strlen(data_str),
+                                                         strlen(data_str)+1,
                                                          (void **)&data->data,
                                                          &data->length, false);
                                                          (void **)&data->data,
                                                          &data->length, false);
-
                        break;
 
                case REG_DWORD: {
                        break;
 
                case REG_DWORD: {