Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/sparc64/dev Fix off-by-one in LOMlite hostname code...



details:   https://anonhg.NetBSD.org/src/rev/873f8612cff3
branches:  trunk
changeset: 753308:873f8612cff3
user:      nakayama <nakayama%NetBSD.org@localhost>
date:      Mon Mar 22 18:38:43 2010 +0000

description:
Fix off-by-one in LOMlite hostname code.  From rev 1.21 of OpenBSD.

diffstat:

 sys/arch/sparc64/dev/lom.c |  10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)

diffs (38 lines):

diff -r 4c404630c54e -r 873f8612cff3 sys/arch/sparc64/dev/lom.c
--- a/sys/arch/sparc64/dev/lom.c        Mon Mar 22 18:36:27 2010 +0000
+++ b/sys/arch/sparc64/dev/lom.c        Mon Mar 22 18:38:43 2010 +0000
@@ -1,5 +1,5 @@
-/*     $NetBSD: lom.c,v 1.5 2009/12/28 18:25:44 nakayama Exp $ */
-/*     $OpenBSD: lom.c,v 1.20 2009/12/12 13:01:00 kettenis Exp $       */
+/*     $NetBSD: lom.c,v 1.6 2010/03/22 18:38:43 nakayama Exp $ */
+/*     $OpenBSD: lom.c,v 1.21 2010/02/28 20:44:39 kettenis Exp $       */
 /*
  * Copyright (c) 2009 Mark Kettenis
  *
@@ -17,7 +17,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: lom.c,v 1.5 2009/12/28 18:25:44 nakayama Exp $");
+__KERNEL_RCSID(0, "$NetBSD: lom.c,v 1.6 2010/03/22 18:38:43 nakayama Exp $");
 
 #include <sys/param.h>
 #include <sys/device.h>
@@ -1035,7 +1035,7 @@
 static void
 lom1_write_hostname(struct lom_softc *sc)
 {
-       char name[LOM1_IDX_HOSTNAME12 - LOM1_IDX_HOSTNAME1 + 1];
+       char name[(LOM1_IDX_HOSTNAME12 - LOM1_IDX_HOSTNAME1 + 1) + 1];
        char *p;
        int i;
 
@@ -1045,7 +1045,7 @@
         * strip off the domain name.
         */
        strlcpy(name, hostname, sizeof(name));
-       if (hostnamelen > sizeof(name)) {
+       if (hostnamelen >= sizeof(name)) {
                p = strchr(name, '.');
                if (p)
                        *p = '\0';



Home | Main Index | Thread Index | Old Index