Module Name:    src
Committed By:   christos
Date:           Fri Jan 13 20:25:35 UTC 2017

Modified Files:
        src/sys/compat/common: vfs_syscalls_43.c

Log Message:
convert strcpy to a bounded copy to avoid compiler warnings, although the
reclen test prevents overflow.


To generate a diff of this commit:
cvs rdiff -u -r1.58 -r1.59 src/sys/compat/common/vfs_syscalls_43.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/compat/common/vfs_syscalls_43.c
diff -u src/sys/compat/common/vfs_syscalls_43.c:1.58 src/sys/compat/common/vfs_syscalls_43.c:1.59
--- src/sys/compat/common/vfs_syscalls_43.c:1.58	Fri Aug 19 20:34:42 2016
+++ src/sys/compat/common/vfs_syscalls_43.c	Fri Jan 13 15:25:35 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: vfs_syscalls_43.c,v 1.58 2016/08/20 00:34:42 mrg Exp $	*/
+/*	$NetBSD: vfs_syscalls_43.c,v 1.59 2017/01/13 20:25:35 christos Exp $	*/
 
 /*
  * Copyright (c) 1989, 1993
@@ -37,7 +37,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls_43.c,v 1.58 2016/08/20 00:34:42 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls_43.c,v 1.59 2017/01/13 20:25:35 christos Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_compat_netbsd.h"
@@ -475,7 +475,8 @@ again:
 		idb.d_fileno = (uint32_t)bdp->d_fileno;
 		idb.d_reclen = (uint16_t)old_reclen;
 		idb.d_namlen = (uint16_t)bdp->d_namlen;
-		strcpy(idb.d_name, bdp->d_name);
+		memcpy(idb.d_name, bdp->d_name, MIN(sizeof(idb.d_name),
+		    idb.d_namlen));
 		if ((error = copyout(&idb, outp, old_reclen)))
 			goto out;
 		/* advance past this real entry */

Reply via email to