Module Name:    src
Committed By:   christos
Date:           Fri Jan 13 20:24:37 UTC 2017

Modified Files:
        src/sys/compat/linux/common: linux_misc.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.234 -r1.235 src/sys/compat/linux/common/linux_misc.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/linux/common/linux_misc.c
diff -u src/sys/compat/linux/common/linux_misc.c:1.234 src/sys/compat/linux/common/linux_misc.c:1.235
--- src/sys/compat/linux/common/linux_misc.c:1.234	Mon Jan  2 11:32:10 2017
+++ src/sys/compat/linux/common/linux_misc.c	Fri Jan 13 15:24:37 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: linux_misc.c,v 1.234 2017/01/02 16:32:10 manu Exp $	*/
+/*	$NetBSD: linux_misc.c,v 1.235 2017/01/13 20:24:37 christos Exp $	*/
 
 /*-
  * Copyright (c) 1995, 1998, 1999, 2008 The NetBSD Foundation, Inc.
@@ -57,7 +57,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: linux_misc.c,v 1.234 2017/01/02 16:32:10 manu Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_misc.c,v 1.235 2017/01/13 20:24:37 christos Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -787,7 +787,8 @@ again:
 			/* Linux puts d_type at the end of each record */
 			*((char *)&idb + idb.d_reclen - 1) = bdp->d_type;
 		}
-		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((void *)&idb, outp, linux_reclen)))
 			goto out;
 		/* advance past this real entry */

Reply via email to