svn commit: r286644 - head/sys/contrib/libnv

Mariusz Zaborski oshogbo at FreeBSD.org
Tue Aug 11 17:54:52 UTC 2015


Author: oshogbo
Date: Tue Aug 11 17:54:51 2015
New Revision: 286644
URL: https://svnweb.freebsd.org/changeset/base/286644

Log:
  Don't set parent if the unpack operation fail. In some
  case this could crash the library, because of the NULL pointer references.
  
  Discovered thanks to american fuzzy lop.
  
  Approved by:	pjd (mentor)

Modified:
  head/sys/contrib/libnv/nvlist.c

Modified: head/sys/contrib/libnv/nvlist.c
==============================================================================
--- head/sys/contrib/libnv/nvlist.c	Tue Aug 11 17:48:58 2015	(r286643)
+++ head/sys/contrib/libnv/nvlist.c	Tue Aug 11 17:54:51 2015	(r286644)
@@ -824,6 +824,8 @@ nvlist_xunpack(const void *buf, size_t s
 		case NV_TYPE_NVLIST:
 			ptr = nvpair_unpack_nvlist(isbe, nvp, ptr, &left, nfds,
 			    &tmpnvl);
+			if (tmpnvl == NULL || ptr == NULL)
+				goto failed;
 			nvlist_set_parent(tmpnvl, nvp);
 			break;
 #ifndef _KERNEL


More information about the svn-src-all mailing list