summaryrefslogtreecommitdiffstats
path: root/sys/contrib/libnv
diff options
context:
space:
mode:
authoroshogbo <oshogbo@FreeBSD.org>2015-08-11 17:54:51 +0000
committeroshogbo <oshogbo@FreeBSD.org>2015-08-11 17:54:51 +0000
commit7ad07c63652bfc184ad44015e734dcfc719822c2 (patch)
tree3fc29c9f705381de45f922aedac63af22dbfc909 /sys/contrib/libnv
parent96cc308aa82efa87c3753c06f1039a9c921dccd3 (diff)
downloadFreeBSD-src-7ad07c63652bfc184ad44015e734dcfc719822c2.zip
FreeBSD-src-7ad07c63652bfc184ad44015e734dcfc719822c2.tar.gz
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)
Diffstat (limited to 'sys/contrib/libnv')
-rw-r--r--sys/contrib/libnv/nvlist.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/sys/contrib/libnv/nvlist.c b/sys/contrib/libnv/nvlist.c
index cdb54d2..5809f73 100644
--- a/sys/contrib/libnv/nvlist.c
+++ b/sys/contrib/libnv/nvlist.c
@@ -824,6 +824,8 @@ nvlist_xunpack(const void *buf, size_t size, const int *fds, size_t nfds,
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
OpenPOWER on IntegriCloud