diff options
author | ngie <ngie@FreeBSD.org> | 2017-06-01 06:17:01 +0000 |
---|---|---|
committer | ngie <ngie@FreeBSD.org> | 2017-06-01 06:17:01 +0000 |
commit | d58474a488c9bc574ae1e46ec41a92023deb4de6 (patch) | |
tree | 1c031cf1092dc29aec1b0c0bf0fdfbc242419d25 /lib | |
parent | ce1fca000ff417689552ae31824c805ee6999b19 (diff) | |
download | FreeBSD-src-d58474a488c9bc574ae1e46ec41a92023deb4de6.zip FreeBSD-src-d58474a488c9bc574ae1e46ec41a92023deb4de6.tar.gz |
MFC r319156,r319159:
r319156:
:nvlist_unpack__duplicate_key : check the result of nvlist_pack(3)
This fixes a potential NULL pointer dereference.
CID: 1362051
r319159:
:dnvlist_get_string__default_value: fix a bogus string comparison test
Check actual_value vs "5", not "5" vs itself.
CID: 1362021
Diffstat (limited to 'lib')
-rw-r--r-- | lib/libnv/tests/dnv_tests.cc | 2 | ||||
-rw-r--r-- | lib/libnv/tests/nv_tests.cc | 1 |
2 files changed, 2 insertions, 1 deletions
diff --git a/lib/libnv/tests/dnv_tests.cc b/lib/libnv/tests/dnv_tests.cc index a21a91d..b00388a 100644 --- a/lib/libnv/tests/dnv_tests.cc +++ b/lib/libnv/tests/dnv_tests.cc @@ -150,7 +150,7 @@ ATF_TEST_CASE_BODY(dnvlist_get_string__default_value) ATF_REQUIRE_EQ(strcmp(dnvlist_get_string(nvl, "hthth", "fd"), "fd"), 0); actual_value = dnvlist_get_string(nvl, "5", "5"); - ATF_REQUIRE_EQ(strcmp("5", "5"), 0); + ATF_REQUIRE_EQ(strcmp(actual_value, "5"), 0); nvlist_destroy(nvl); } diff --git a/lib/libnv/tests/nv_tests.cc b/lib/libnv/tests/nv_tests.cc index 1c65b66..3464d20 100644 --- a/lib/libnv/tests/nv_tests.cc +++ b/lib/libnv/tests/nv_tests.cc @@ -640,6 +640,7 @@ ATF_TEST_CASE_BODY(nvlist_unpack__duplicate_key) nvlist_add_number(nvl, key2, 10); packed = nvlist_pack(nvl, &size); + ATF_REQUIRE(packed != NULL); /* * Mangle the packed nvlist by replacing key1 with key2, creating a |