From adaf7e89c1514e08eeb567ef26888d099ad6d776 Mon Sep 17 00:00:00 2001 From: Martijn van Duren Date: Sun, 31 May 2020 21:02:00 +0000 Subject: Fix an of by one when printing the oid of the error index. --- usr.bin/snmp/snmpc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'usr.bin/snmp/snmpc.c') diff --git a/usr.bin/snmp/snmpc.c b/usr.bin/snmp/snmpc.c index 4217a223802..62fb1201a38 100644 --- a/usr.bin/snmp/snmpc.c +++ b/usr.bin/snmp/snmpc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: snmpc.c,v 1.25 2020/05/19 13:41:01 martijn Exp $ */ +/* $OpenBSD: snmpc.c,v 1.26 2020/05/31 21:01:59 martijn Exp $ */ /* * Copyright (c) 2019 Martijn van Duren @@ -1098,7 +1098,7 @@ snmpc_printerror(enum snmp_error error, struct ber_element *varbind, if (index >= 1) { /* Only print if the index is in the reply */ - for (i = 1; varbind != NULL && i <= index; + for (i = 1; varbind != NULL && i < index; varbind = varbind->be_next) i++; if (varbind != NULL && -- cgit v1.2.3