diff options
author | Volker Lendecke <vl@samba.org> | 2013-11-09 18:40:08 +0100 |
---|---|---|
committer | Ira Cooper <ira@samba.org> | 2013-11-11 21:04:08 +0100 |
commit | ba370ae630e1f35cd20d6419100b5e0987382cfc (patch) | |
tree | 6ac9801d7147fad531cadce847913122ad855b60 | |
parent | 4e80a30daa16a6c0d0f1f96380fb213867f3ad5f (diff) | |
download | samba-ba370ae630e1f35cd20d6419100b5e0987382cfc.tar.gz samba-ba370ae630e1f35cd20d6419100b5e0987382cfc.tar.xz samba-ba370ae630e1f35cd20d6419100b5e0987382cfc.zip |
registry: Fix Coverity ID 1034917 Wrong sizeof argument
sizeof(data_val) is the size of the pointer. This might well be 8 bytes
where the string is only 4 bytes long
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ira Cooper <ira@samba.org>
-rw-r--r-- | source4/lib/registry/tests/registry.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/source4/lib/registry/tests/registry.c b/source4/lib/registry/tests/registry.c index ddf402c948c..0c3c395e65f 100644 --- a/source4/lib/registry/tests/registry.c +++ b/source4/lib/registry/tests/registry.c @@ -449,14 +449,15 @@ static bool test_get_value(struct torture_context *tctx, void *_data) torture_assert_int_equal(tctx, REG_DWORD, type, "value type"); error = reg_val_set(subkey, "", REG_SZ, - data_blob_talloc(tctx, data_val, sizeof(data_val))); + data_blob_talloc(tctx, data_val, + strlen(data_val))); torture_assert_werr_ok(tctx, error, "set default value"); error = reg_key_get_value_by_name(tctx, subkey, "", &type, &data); torture_assert_werr_ok(tctx, error, "getting default value"); torture_assert_int_equal(tctx, REG_SZ, type, "value type ok"); - torture_assert_int_equal(tctx, sizeof(data_val), data.length, "value length ok"); + torture_assert_int_equal(tctx, strlen(data_val), data.length, "value length ok"); torture_assert_str_equal(tctx, data_val, (char *)data.data, "value ok"); return true; |