Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/external/bsd/libnv/dist fix the shit, as usual



details:   https://anonhg.NetBSD.org/src/rev/4942ee6f1f12
branches:  trunk
changeset: 445181:4942ee6f1f12
user:      maxv <maxv%NetBSD.org@localhost>
date:      Tue Oct 16 13:18:25 2018 +0000

description:
fix the shit, as usual

diffstat:

 sys/external/bsd/libnv/dist/nv_kern_netbsd.c |  11 +++++++----
 1 files changed, 7 insertions(+), 4 deletions(-)

diffs (46 lines):

diff -r a423c32cf295 -r 4942ee6f1f12 sys/external/bsd/libnv/dist/nv_kern_netbsd.c
--- a/sys/external/bsd/libnv/dist/nv_kern_netbsd.c      Tue Oct 16 11:28:30 2018 +0000
+++ b/sys/external/bsd/libnv/dist/nv_kern_netbsd.c      Tue Oct 16 13:18:25 2018 +0000
@@ -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_t *nvl;
        void *buf;
 
+       if (len == 0) {
+               return EINVAL;
+       }
        if (len >= lim) {
                return E2BIG;
        }
@@ -124,7 +127,7 @@
        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 @@
        s2 = nv_malloc(len);
        if (s2) {
                memcpy(s2, s1, len);
-               s2[len] = '\0';
+               s2[len-1] = '\0';
        }
        return s2;
 }



Home | Main Index | Thread Index | Old Index