Module Name: src Committed By: matt Date: Fri Mar 16 07:23:38 UTC 2012
Modified Files: src/sys/arch/powerpc/booke: copyin.c Log Message: Make sure to have copyinstr return ENAMETOOLONG if the string was too long. To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/sys/arch/powerpc/booke/copyin.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/arch/powerpc/booke/copyin.c diff -u src/sys/arch/powerpc/booke/copyin.c:1.4 src/sys/arch/powerpc/booke/copyin.c:1.5 --- src/sys/arch/powerpc/booke/copyin.c:1.4 Mon Jun 20 05:20:37 2011 +++ src/sys/arch/powerpc/booke/copyin.c Fri Mar 16 07:23:38 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: copyin.c,v 1.4 2011/06/20 05:20:37 matt Exp $ */ +/* $NetBSD: copyin.c,v 1.5 2012/03/16 07:23:38 matt Exp $ */ /*- * Copyright (c) 2010, 2011 The NetBSD Foundation, Inc. @@ -36,7 +36,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: copyin.c,v 1.4 2011/06/20 05:20:37 matt Exp $"); +__KERNEL_RCSID(0, "$NetBSD: copyin.c,v 1.5 2012/03/16 07:23:38 matt Exp $"); #include <sys/param.h> #include <sys/lwp.h> @@ -314,5 +314,8 @@ copyinstr(const void *usaddr, void *kdad pcb->pcb_onfault = NULL; if (done) *done = copylen; - return 0; + /* + * If the last byte is not NUL (0), then the name is too long. + */ + return (uint8_t)data ? ENAMETOOLONG : 0; }