summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOtto Moerbeek <otto@cvs.openbsd.org>2006-03-17 08:23:15 +0000
committerOtto Moerbeek <otto@cvs.openbsd.org>2006-03-17 08:23:15 +0000
commit7b682b3417ffb86bfa19d25ced33eca7604ca193 (patch)
tree605f20d2302d5c435ba2ab7917c73ed0b04c2f35
parent160b884359d736d16e9705869212b7fc154f380e (diff)
fix a few off-by-ones; from NetBSD; ok deraadt@
-rw-r--r--libexec/talkd/print.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/libexec/talkd/print.c b/libexec/talkd/print.c
index c37d50014a1..022357b082a 100644
--- a/libexec/talkd/print.c
+++ b/libexec/talkd/print.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: print.c,v 1.9 2004/03/10 04:32:45 deraadt Exp $ */
+/* $OpenBSD: print.c,v 1.10 2006/03/17 08:23:14 otto Exp $ */
/*
* Copyright (c) 1983 Regents of the University of California.
@@ -31,7 +31,7 @@
#ifndef lint
/*static char sccsid[] = "from: @(#)print.c 5.8 (Berkeley) 2/26/91";*/
-static char rcsid[] = "$Id: print.c,v 1.9 2004/03/10 04:32:45 deraadt Exp $";
+static char rcsid[] = "$Id: print.c,v 1.10 2006/03/17 08:23:14 otto Exp $";
#endif /* not lint */
/* debug print routines */
@@ -59,7 +59,7 @@ print_request(char *cp, CTL_MSG *mp)
{
char tbuf[80], *tp;
- if (mp->type > NTYPES) {
+ if (mp->type >= NTYPES) {
(void)snprintf(tbuf, sizeof(tbuf), "type %d", mp->type);
tp = tbuf;
} else
@@ -73,12 +73,12 @@ print_response(char *cp, CTL_RESPONSE *rp)
{
char tbuf[80], *tp, abuf[80], *ap;
- if (rp->type > NTYPES) {
+ if (rp->type >= NTYPES) {
(void)snprintf(tbuf, sizeof(tbuf), "type %d", rp->type);
tp = tbuf;
} else
tp = types[rp->type];
- if (rp->answer > NANSWERS) {
+ if (rp->answer >= NANSWERS) {
(void)snprintf(abuf, sizeof(abuf), "answer %d", rp->answer);
ap = abuf;
} else