Author: ngie
Date: Thu Jun  1 06:16:57 2017
New Revision: 319370
URL: https://svnweb.freebsd.org/changeset/base/319370

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/10/lib/libnv/tests/dnv_tests.cc
  stable/10/lib/libnv/tests/nv_tests.cc
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/lib/libnv/tests/dnv_tests.cc
==============================================================================
--- stable/10/lib/libnv/tests/dnv_tests.cc      Thu Jun  1 06:12:25 2017        
(r319369)
+++ stable/10/lib/libnv/tests/dnv_tests.cc      Thu Jun  1 06:16:57 2017        
(r319370)
@@ -148,7 +148,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/10/lib/libnv/tests/nv_tests.cc
==============================================================================
--- stable/10/lib/libnv/tests/nv_tests.cc       Thu Jun  1 06:12:25 2017        
(r319369)
+++ stable/10/lib/libnv/tests/nv_tests.cc       Thu Jun  1 06:16:57 2017        
(r319370)
@@ -605,6 +605,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
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to