Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 1 Jun 2017 06:16:58 +0000 (UTC)
From:      Ngie Cooper <ngie@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org
Subject:   svn commit: r319370 - stable/10/lib/libnv/tests
Message-ID:  <201706010616.v516GwpH068148@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201706010616.v516GwpH068148>