Frank Fock | 3 Dec 2009 20:46
Favicon

Re: SNMP4J Agent 1.3.2: NullPointer Exception when receiving GET requests with unknown community strings

Hi Gianluca,

This is indeed a bug. Although it has no security
relevance, it has regarding authenticationFailure
trap generation and counter incrementation.

The below patch fixes it:

Index: SnmpCommunityMIB.java
===================================================================
--- SnmpCommunityMIB.java	(revision 1664)
+++ SnmpCommunityMIB.java	(working copy)
 <at>  <at>  -543,8 +543,10  <at>  <at> 
      if (coexistenceInfo == null) {
        return null;
      }
-    SortedSet cinfos = new 
TreeSet((SortedSet)coexistenceInfo.get(community));
+    SortedSet cinfos = (SortedSet)coexistenceInfo.get(community);
      if (cinfos != null) {
+      // make a copy to improve consistency on concurrent access
+      cinfos = new TreeSet(cinfos);
        Iterator it = cinfos.iterator();
        CoexistenceInfo[] infos = new CoexistenceInfo[cinfos.size()];
        for (int i=0; i<infos.length; i++) {

Best regards,
Frank

Gianluca Uberti wrote:
(Continue reading)


Gmane