summaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2005-04-21 00:26:48 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2005-04-21 00:26:48 +0000
commitf7608f9aa9ef4dd45bc2f177d51dfe7c88d3138d (patch)
tree99feffbb1388a0ad7c450cba462bfdd59641bb26 /sys/dev
parent251222e6623b5dd2d92f8dd3d4962ffd32d294ee (diff)
correct idion for snprintf failure handling; ok cloder
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/wscons/wsemul_vt100_subr.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/sys/dev/wscons/wsemul_vt100_subr.c b/sys/dev/wscons/wsemul_vt100_subr.c
index b0fab8f1735..76a0b2041aa 100644
--- a/sys/dev/wscons/wsemul_vt100_subr.c
+++ b/sys/dev/wscons/wsemul_vt100_subr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: wsemul_vt100_subr.c,v 1.12 2004/12/23 21:46:56 miod Exp $ */
+/* $OpenBSD: wsemul_vt100_subr.c,v 1.13 2005/04/21 00:26:29 deraadt Exp $ */
/* $NetBSD: wsemul_vt100_subr.c,v 1.7 2000/04/28 21:56:16 mycroft Exp $ */
/*
@@ -339,6 +339,10 @@ wsemul_vt100_handle_csi(edp, c)
if (edp->tabs[i]) {
n = snprintf(buf, sizeof buf, "%s%d",
(ps ? "/" : ""), i + 1);
+ if (n == -1)
+ n = 0;
+ else if (n >= sizeof buf)
+ n = sizeof buf - 1;
wsdisplay_emulinput(edp->cbcookie,
buf, n);
ps = 1;
@@ -562,6 +566,10 @@ wsemul_vt100_handle_csi(edp, c)
row = edp->crow;
n = snprintf(buf, sizeof buf, "\033[%d;%dR",
row + 1, edp->ccol + 1);
+ if (n == -1)
+ n = 0;
+ else if (n >= sizeof buf)
+ n = sizeof buf - 1;
wsdisplay_emulinput(edp->cbcookie, buf, n);
}
break;