svn commit: r319371 - stable/11/lib/libnv/tests

Ngie Cooper ngie at FreeBSD.org
Thu Jun 1 06:17:02 UTC 2017


Author: ngie
Date: Thu Jun  1 06:17:01 2017
New Revision: 319371
URL: https://svnweb.freebsd.org/changeset/base/319371

Log:
  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

Modified:
  stable/11/lib/libnv/tests/dnv_tests.cc
  stable/11/lib/libnv/tests/nv_tests.cc
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/lib/libnv/tests/dnv_tests.cc
==============================================================================
--- stable/11/lib/libnv/tests/dnv_tests.cc	Thu Jun  1 06:16:57 2017	(r319370)
+++ stable/11/lib/libnv/tests/dnv_tests.cc	Thu Jun  1 06:17:01 2017	(r319371)
@@ -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);
 }

Modified: stable/11/lib/libnv/tests/nv_tests.cc
==============================================================================
--- stable/11/lib/libnv/tests/nv_tests.cc	Thu Jun  1 06:16:57 2017	(r319370)
+++ stable/11/lib/libnv/tests/nv_tests.cc	Thu Jun  1 06:17:01 2017	(r319371)
@@ -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


More information about the svn-src-stable mailing list