Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 10 Oct 2014 00:26:28 +0000 (UTC)
From:      Shteryana Shopova <syrinx@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r272878 - head/contrib/bsnmp/snmp_target
Message-ID:  <201410100026.s9A0QSFU006258@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: syrinx
Date: Fri Oct 10 00:26:28 2014
New Revision: 272878
URL: https://svnweb.freebsd.org/changeset/base/272878

Log:
  Fix a bug in decoding string indexes in snmp_target(3), thus causing
  bsnmpd(1) to not send v3 notifications properly; while here add two
  missing return statements which could lead to abort() in case of a
  rollback

Modified:
  head/contrib/bsnmp/snmp_target/target_snmp.c

Modified: head/contrib/bsnmp/snmp_target/target_snmp.c
==============================================================================
--- head/contrib/bsnmp/snmp_target/target_snmp.c	Fri Oct 10 00:26:00 2014	(r272877)
+++ head/contrib/bsnmp/snmp_target/target_snmp.c	Fri Oct 10 00:26:28 2014	(r272878)
@@ -301,6 +301,7 @@ op_snmp_target_addrs(struct snmp_context
 		default:
 			break;	
 		}
+		return (SNMP_ERR_NOERROR);
 
 	default:
 		abort();
@@ -625,6 +626,7 @@ op_snmp_notify(struct snmp_context *ctx 
 		default:
 			break;
 		}
+		return (SNMP_ERR_NOERROR);
 
 	default:
 		abort();
@@ -663,13 +665,14 @@ target_append_index(struct asn_oid *oid,
 static int
 target_decode_index(const struct asn_oid *oid, uint sub, char *name)
 {
-	uint32_t i, len;
+	uint32_t i;
 
-	if ((len = oid->len - sub) >= SNMP_ADM_STR32_SIZ)
+	if (oid->len - sub != oid->subs[sub] + 1 || oid->subs[sub] >=
+	    SNMP_ADM_STR32_SIZ)
 		return (-1);
 
-	for (i = 0; i < len; i++)
-		name[i] = oid->subs[sub + i];
+	for (i = 0; i < oid->subs[sub]; i++)
+		name[i] = oid->subs[sub + i + 1];
 	name[i] = '\0';
 
 	return (0);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201410100026.s9A0QSFU006258>