From ee2ef874e982577e978c19bed88c55e8b5680a20 Mon Sep 17 00:00:00 2001 From: christos Date: Sat, 28 Jan 2017 15:01:01 +0000 Subject: copy the terminating NUL (njoly) --- sys/compat/linux/common/linux_file64.c | 6 +++--- sys/compat/linux/common/linux_misc.c | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 'sys/compat/linux') diff --git a/sys/compat/linux/common/linux_file64.c b/sys/compat/linux/common/linux_file64.c index 40823c79e8f..e54db931de4 100644 --- a/sys/compat/linux/common/linux_file64.c +++ b/sys/compat/linux/common/linux_file64.c @@ -1,4 +1,4 @@ -/* $NetBSD: linux_file64.c,v 1.57 2017/01/13 22:46:43 christos Exp $ */ +/* $NetBSD: linux_file64.c,v 1.58 2017/01/28 15:01:01 christos Exp $ */ /*- * Copyright (c) 1995, 1998, 2000, 2008 The NetBSD Foundation, Inc. @@ -34,7 +34,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: linux_file64.c,v 1.57 2017/01/13 22:46:43 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: linux_file64.c,v 1.58 2017/01/28 15:01:01 christos Exp $"); #include #include @@ -355,7 +355,7 @@ again: idb.d_off = off; idb.d_reclen = (u_short)linux_reclen; memcpy(idb.d_name, bdp->d_name, MIN(sizeof(idb.d_name), - bdp->d_namlen)); + bdp->d_namlen + 1)); if ((error = copyout((void *)&idb, outp, linux_reclen))) goto out; /* advance past this real entry */ diff --git a/sys/compat/linux/common/linux_misc.c b/sys/compat/linux/common/linux_misc.c index 9fa1ee51489..ca04fb1447c 100644 --- a/sys/compat/linux/common/linux_misc.c +++ b/sys/compat/linux/common/linux_misc.c @@ -1,4 +1,4 @@ -/* $NetBSD: linux_misc.c,v 1.236 2017/01/13 22:45:15 christos Exp $ */ +/* $NetBSD: linux_misc.c,v 1.237 2017/01/28 15:01:01 christos Exp $ */ /*- * Copyright (c) 1995, 1998, 1999, 2008 The NetBSD Foundation, Inc. @@ -57,7 +57,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: linux_misc.c,v 1.236 2017/01/13 22:45:15 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: linux_misc.c,v 1.237 2017/01/28 15:01:01 christos Exp $"); #include #include @@ -788,7 +788,7 @@ again: *((char *)&idb + idb.d_reclen - 1) = bdp->d_type; } memcpy(idb.d_name, bdp->d_name, - MIN(sizeof(idb.d_name), bdp->d_namlen)); + MIN(sizeof(idb.d_name), bdp->d_namlen + 1)); if ((error = copyout((void *)&idb, outp, linux_reclen))) goto out; /* advance past this real entry */ -- cgit