Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/powerpc/booke Make sure to have copyinstr return EN...



details:   https://anonhg.NetBSD.org/src/rev/5ddce3856050
branches:  trunk
changeset: 778100:5ddce3856050
user:      matt <matt%NetBSD.org@localhost>
date:      Fri Mar 16 07:23:38 2012 +0000

description:
Make sure to have copyinstr return ENAMETOOLONG if the string was too long.

diffstat:

 sys/arch/powerpc/booke/copyin.c |  9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)

diffs (28 lines):

diff -r 9d536c3d9388 -r 5ddce3856050 sys/arch/powerpc/booke/copyin.c
--- a/sys/arch/powerpc/booke/copyin.c   Fri Mar 16 06:47:37 2012 +0000
+++ b/sys/arch/powerpc/booke/copyin.c   Fri Mar 16 07:23:38 2012 +0000
@@ -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 @@
        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;
 }



Home | Main Index | Thread Index | Old Index