From cf66982b37ec7230cc55175c994e05c6176e8e22 Mon Sep 17 00:00:00 2001 From: oshogbo Date: Sat, 2 May 2015 17:45:52 +0000 Subject: =?UTF-8?q?Approved,=20opr=C3=B3cz=20u=C5=BCycie=20RESTORE=5FERRNO?= =?UTF-8?q?()=20do=20ustawiania=20errno.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change the nvlist_recv() function to take additional argument that specifies flags expected on the received nvlist. Receiving a nvlist with different set of flags than the ones we expect might lead to undefined behaviour, which might be potentially dangerous. Update consumers of this and related functions and update the tests. Approved by: pjd (mentor) Update man page for nvlist_unpack, nvlist_recv, nvlist_xfer, cap_recv_nvlist and cap_xfer_nvlist. Reviewed by: AllanJude Approved by: pjd (mentor) --- lib/libnv/tests/nv_tests.cc | 6 +++--- lib/libnv/tests/nvlist_send_recv_test.c | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'lib/libnv/tests') diff --git a/lib/libnv/tests/nv_tests.cc b/lib/libnv/tests/nv_tests.cc index 2d9fd97..1fee182 100644 --- a/lib/libnv/tests/nv_tests.cc +++ b/lib/libnv/tests/nv_tests.cc @@ -440,7 +440,7 @@ ATF_TEST_CASE_BODY(nvlist_pack__empty_nvlist) packed = nvlist_pack(nvl, &packed_size); ATF_REQUIRE(packed != NULL); - unpacked = nvlist_unpack(packed, packed_size); + unpacked = nvlist_unpack(packed, packed_size, 0); ATF_REQUIRE(unpacked != NULL); ATF_REQUIRE(unpacked != nvl); ATF_REQUIRE(nvlist_empty(unpacked)); @@ -534,7 +534,7 @@ ATF_TEST_CASE_BODY(nvlist_pack__multiple_values) packed = nvlist_pack(nvl, &packed_size); ATF_REQUIRE(packed != NULL); - unpacked = nvlist_unpack(packed, packed_size); + unpacked = nvlist_unpack(packed, packed_size, 0); ATF_REQUIRE(unpacked != 0); it = NULL; @@ -614,7 +614,7 @@ ATF_TEST_CASE_BODY(nvlist_unpack__duplicate_key) ATF_REQUIRE(keypos != NULL); memcpy(keypos, key2, keylen); - unpacked = nvlist_unpack(packed, size); + unpacked = nvlist_unpack(packed, size, 0); ATF_REQUIRE(nvlist_error(unpacked) != 0); free(packed); diff --git a/lib/libnv/tests/nvlist_send_recv_test.c b/lib/libnv/tests/nvlist_send_recv_test.c index 1b083c3..50222fb 100644 --- a/lib/libnv/tests/nvlist_send_recv_test.c +++ b/lib/libnv/tests/nvlist_send_recv_test.c @@ -95,7 +95,7 @@ parent(int sock) int type, ctype; size_t size; - nvl = nvlist_recv(sock); + nvl = nvlist_recv(sock, 0); CHECK(nvlist_error(nvl) == 0); if (nvlist_error(nvl) != 0) err(1, "nvlist_recv() failed"); -- cgit v1.1