Module Name: src Committed By: maxv Date: Tue Oct 16 13:18:25 UTC 2018
Modified Files: src/sys/external/bsd/libnv/dist: nv_kern_netbsd.c Log Message: fix the shit, as usual To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/sys/external/bsd/libnv/dist/nv_kern_netbsd.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/external/bsd/libnv/dist/nv_kern_netbsd.c diff -u src/sys/external/bsd/libnv/dist/nv_kern_netbsd.c:1.5 src/sys/external/bsd/libnv/dist/nv_kern_netbsd.c:1.6 --- src/sys/external/bsd/libnv/dist/nv_kern_netbsd.c:1.5 Sun Sep 23 21:35:26 2018 +++ src/sys/external/bsd/libnv/dist/nv_kern_netbsd.c Tue Oct 16 13:18:25 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: nv_kern_netbsd.c,v 1.5 2018/09/23 21:35:26 rmind Exp $ */ +/* $NetBSD: nv_kern_netbsd.c,v 1.6 2018/10/16 13:18:25 maxv Exp $ */ /*- * Copyright (c) 2018 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include <sys/cdefs.h> -__RCSID("$NetBSD: nv_kern_netbsd.c,v 1.5 2018/09/23 21:35:26 rmind Exp $"); +__RCSID("$NetBSD: nv_kern_netbsd.c,v 1.6 2018/10/16 13:18:25 maxv Exp $"); #if !defined(_KERNEL) && !defined(_STANDALONE) #include <sys/mman.h> @@ -78,6 +78,9 @@ nvlist_copyin(const nvlist_ref_t *nref, nvlist_t *nvl; void *buf; + if (len == 0) { + return EINVAL; + } if (len >= lim) { return E2BIG; } @@ -124,7 +127,7 @@ nvlist_copyout(nvlist_ref_t *nref, const error = copyout(buf, uaddr, len); if (error) { uvm_unmap(&p->p_vmspace->vm_map, (vaddr_t)uaddr, - (vaddr_t)uaddr + len); + (vaddr_t)uaddr + rlen); goto err; } nref->flags = nvlist_flags(nvl); @@ -225,7 +228,7 @@ nv_strdup(const char *s1) s2 = nv_malloc(len); if (s2) { memcpy(s2, s1, len); - s2[len] = '\0'; + s2[len-1] = '\0'; } return s2; }