summaryrefslogtreecommitdiff
path: root/sys/arch
diff options
context:
space:
mode:
authorMark Kettenis <kettenis@cvs.openbsd.org>2010-02-28 20:44:40 +0000
committerMark Kettenis <kettenis@cvs.openbsd.org>2010-02-28 20:44:40 +0000
commit138c8d77ecb62919b032a32bed89c7de6d0088aa (patch)
treed6f392273a1435e26aa49455a90ad426e57ffdb4 /sys/arch
parentd30e4d3271a3fae92f385b832f32f7d0156c8dfe (diff)
Fix off-by-one in LOMlite hostname code.
Diffstat (limited to 'sys/arch')
-rw-r--r--sys/arch/sparc64/dev/lom.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/sys/arch/sparc64/dev/lom.c b/sys/arch/sparc64/dev/lom.c
index 2c2139a6738..bd400a86425 100644
--- a/sys/arch/sparc64/dev/lom.c
+++ b/sys/arch/sparc64/dev/lom.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: lom.c,v 1.20 2009/12/12 13:01:00 kettenis Exp $ */
+/* $OpenBSD: lom.c,v 1.21 2010/02/28 20:44:39 kettenis Exp $ */
/*
* Copyright (c) 2009 Mark Kettenis
*
@@ -947,7 +947,7 @@ lom_refresh(void *arg)
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;
@@ -957,7 +957,7 @@ lom1_write_hostname(struct lom_softc *sc)
* 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';