[AGENT++] R: R: pure virtual method called

Jochen Katz katz at agentpp.com
Mon Feb 21 21:36:02 CET 2011


Hi,

> I'm attaching the gdb output for the snmpTraps:
> 
> #0  0x00011920 in IpAddress::parse_address (this=0xbeb499c8, inaddr=0xbeb498c8 "EK250") at address.cpp:881

this is the memcpy seen below. If this fails, the h_addr (which is
h_addr_list[0]) must be null. Please try the patch below.

Regards,
  Jochen


--- address.cpp (Revision 1969)
+++ address.cpp (Arbeitskopie)
@@ -853,6 +853,12 @@
 #ifdef SNMP_PP_IPv6
       if (lookupResult->h_length == sizeof(in6_addr))
       {
+        if (!lookupResult->h_addr_list[0])
+        {
+          debugprintf(1, "Error resolving host name");
+          return false;
+        }
+
         in6_addr ipAddr;
         memcpy((void *) &ipAddr, (void *) lookupResult->h_addr,
                sizeof(in6_addr));
@@ -872,8 +878,13 @@
 #endif // SNMP_PP_IPv6
       if (lookupResult->h_length == sizeof(in_addr))
       {
+        if (!lookupResult->h_addr_list[0])
+        {
+          debugprintf(1, "Error resolving host name");
+          return false;
+        }
+
         in_addr ipAddr;
-
         memcpy((void *) &ipAddr, (void *) lookupResult->h_addr,
                sizeof(in_addr));



More information about the AGENTPP mailing list