Module Name: src Committed By: nakayama Date: Mon Mar 22 18:38:43 UTC 2010
Modified Files: src/sys/arch/sparc64/dev: lom.c Log Message: Fix off-by-one in LOMlite hostname code. From rev 1.21 of OpenBSD. To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/sys/arch/sparc64/dev/lom.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/sparc64/dev/lom.c diff -u src/sys/arch/sparc64/dev/lom.c:1.5 src/sys/arch/sparc64/dev/lom.c:1.6 --- src/sys/arch/sparc64/dev/lom.c:1.5 Mon Dec 28 18:25:44 2009 +++ src/sys/arch/sparc64/dev/lom.c Mon Mar 22 18:38:43 2010 @@ -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';