|
|
f13900 |
diff -urNp a/agent/snmp_agent.c b/agent/snmp_agent.c
|
|
|
f13900 |
--- a/agent/snmp_agent.c 2020-06-11 10:20:31.646339191 +0200
|
|
|
f13900 |
+++ b/agent/snmp_agent.c 2020-06-11 10:23:41.178056889 +0200
|
|
|
f13900 |
@@ -1605,12 +1605,6 @@ free_agent_snmp_session(netsnmp_agent_se
|
|
|
f13900 |
DEBUGMSGTL(("verbose:asp", "asp %p reqinfo %p freed\n",
|
|
|
f13900 |
asp, asp->reqinfo));
|
|
|
f13900 |
|
|
|
f13900 |
- /* Clean up securityStateRef here to prevent a double free */
|
|
|
f13900 |
- if (asp->orig_pdu && asp->orig_pdu->securityStateRef)
|
|
|
f13900 |
- snmp_free_securityStateRef(asp->orig_pdu);
|
|
|
f13900 |
- if (asp->pdu && asp->pdu->securityStateRef)
|
|
|
f13900 |
- snmp_free_securityStateRef(asp->pdu);
|
|
|
f13900 |
-
|
|
|
f13900 |
if (asp->orig_pdu)
|
|
|
f13900 |
snmp_free_pdu(asp->orig_pdu);
|
|
|
f13900 |
if (asp->pdu)
|
|
|
f13900 |
diff -urNp a/include/net-snmp/pdu_api.h b/include/net-snmp/pdu_api.h
|
|
|
f13900 |
--- a/include/net-snmp/pdu_api.h 2020-06-11 10:20:31.631339058 +0200
|
|
|
f13900 |
+++ b/include/net-snmp/pdu_api.h 2020-06-11 10:24:17.261390028 +0200
|
|
|
f13900 |
@@ -19,8 +19,6 @@ NETSNMP_IMPORT
|
|
|
f13900 |
netsnmp_pdu *snmp_fix_pdu( netsnmp_pdu *pdu, int idx);
|
|
|
f13900 |
NETSNMP_IMPORT
|
|
|
f13900 |
void snmp_free_pdu( netsnmp_pdu *pdu);
|
|
|
f13900 |
-NETSNMP_IMPORT
|
|
|
f13900 |
-void snmp_free_securityStateRef( netsnmp_pdu *pdu);
|
|
|
f13900 |
|
|
|
f13900 |
#ifdef __cplusplus
|
|
|
f13900 |
}
|
|
|
f13900 |
diff -urNp a/snmplib/snmp_api.c b/snmplib/snmp_api.c
|
|
|
f13900 |
--- a/snmplib/snmp_api.c 2020-06-11 10:20:31.695339627 +0200
|
|
|
f13900 |
+++ b/snmplib/snmp_api.c 2020-06-11 10:33:55.510891945 +0200
|
|
|
f13900 |
@@ -4034,17 +4034,6 @@ free_securityStateRef(netsnmp_pdu* pdu)
|
|
|
f13900 |
pdu->securityStateRef = NULL;
|
|
|
f13900 |
}
|
|
|
f13900 |
|
|
|
f13900 |
-/*
|
|
|
f13900 |
- * This function is here to provide a separate call to
|
|
|
f13900 |
- * free the securityStateRef memory. This is needed to prevent
|
|
|
f13900 |
- * a double free if this memory is freed in snmp_free_pdu.
|
|
|
f13900 |
- */
|
|
|
f13900 |
-void
|
|
|
f13900 |
-snmp_free_securityStateRef(netsnmp_pdu* pdu)
|
|
|
f13900 |
-{
|
|
|
f13900 |
- free_securityStateRef(pdu);
|
|
|
f13900 |
-}
|
|
|
f13900 |
-
|
|
|
f13900 |
#define ERROR_STAT_LENGTH 11
|
|
|
f13900 |
|
|
|
f13900 |
int
|
|
|
f13900 |
@@ -5473,6 +5462,8 @@ snmp_free_pdu(netsnmp_pdu *pdu)
|
|
|
f13900 |
if (!pdu)
|
|
|
f13900 |
return;
|
|
|
f13900 |
|
|
|
f13900 |
+ free_securityStateRef(pdu);
|
|
|
f13900 |
+
|
|
|
f13900 |
/*
|
|
|
f13900 |
* If the command field is empty, that probably indicates
|
|
|
f13900 |
* that this PDU structure has already been freed.
|
|
|
f13900 |
@@ -5647,12 +5638,6 @@ _sess_process_packet_parse_pdu(void *ses
|
|
|
f13900 |
}
|
|
|
f13900 |
|
|
|
f13900 |
if (ret != SNMP_ERR_NOERROR) {
|
|
|
f13900 |
- /*
|
|
|
f13900 |
- * Call the security model to free any securityStateRef supplied w/ msg.
|
|
|
f13900 |
- */
|
|
|
f13900 |
- if (pdu->securityStateRef != NULL) {
|
|
|
f13900 |
- free_securityStateRef(pdu);
|
|
|
f13900 |
- }
|
|
|
f13900 |
snmp_free_pdu(pdu);
|
|
|
f13900 |
return NULL;
|
|
|
f13900 |
}
|
|
|
f13900 |
@@ -5826,12 +5811,6 @@ _sess_process_packet_handle_pdu(void *se
|
|
|
f13900 |
}
|
|
|
f13900 |
}
|
|
|
f13900 |
|
|
|
f13900 |
- /*
|
|
|
f13900 |
- * Call USM to free any securityStateRef supplied with the message.
|
|
|
f13900 |
- */
|
|
|
f13900 |
- if (pdu->securityStateRef && pdu->command == SNMP_MSG_TRAP2)
|
|
|
f13900 |
- free_securityStateRef(pdu);
|
|
|
f13900 |
-
|
|
|
f13900 |
if (!handled) {
|
|
|
f13900 |
if (sp->flags & SNMP_FLAGS_SHARED_SOCKET)
|
|
|
f13900 |
return -2;
|