summaryrefslogtreecommitdiff
path: root/sbin/kbd/kbd_wscons.c
diff options
context:
space:
mode:
authorJared Yanovich <jaredy@cvs.openbsd.org>2004-10-08 13:23:42 +0000
committerJared Yanovich <jaredy@cvs.openbsd.org>2004-10-08 13:23:42 +0000
commit8e58d6cc84f36d50a32264e548083419ddc97232 (patch)
treebd7c4836d560ba25db261b053c900cc0c9ca5acc /sbin/kbd/kbd_wscons.c
parentedc22bdeef1f146e174f14f216d0e17bb46b4598 (diff)
fix an overflow in the encoding/variant parsing. ok miod henning
Diffstat (limited to 'sbin/kbd/kbd_wscons.c')
-rw-r--r--sbin/kbd/kbd_wscons.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/sbin/kbd/kbd_wscons.c b/sbin/kbd/kbd_wscons.c
index a7f4876aa7c..491f5475871 100644
--- a/sbin/kbd/kbd_wscons.c
+++ b/sbin/kbd/kbd_wscons.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kbd_wscons.c,v 1.17 2004/09/16 09:53:56 deraadt Exp $ */
+/* $OpenBSD: kbd_wscons.c,v 1.18 2004/10/08 13:23:41 jaredy Exp $ */
/*
* Copyright (c) 2001 Mats O Jansson. All rights reserved.
@@ -252,7 +252,8 @@ kbd_set(char *name, int verbose)
c = name;
b = buf;
- while ((*c != '.') && (*c != '\0')) {
+ while ((*c != '.') && (*c != '\0') &&
+ (b < buf + sizeof(buf) - 1)) {
*b++ = *c++;
}
*b = '\0';
@@ -268,7 +269,8 @@ kbd_set(char *name, int verbose)
while (*c == '.') {
b = buf;
c++;
- while ((*c != '.') && (*c != '\0')) {
+ while ((*c != '.') && (*c != '\0') &&
+ (b < buf + sizeof(buf) - 1)) {
*b++ = *c++;
}
*b = '\0';