mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2025-01-29 00:32:51 +00:00
Add some comments and OID checks to udpEndpointTable
This commit is contained in:
parent
dfaa979b99
commit
9d1234d83a
@ -2048,23 +2048,42 @@ udp_ep_Table_get_cell_value(const u32_t* column, const u32_t* row_oid, u8_t row_
|
|||||||
|
|
||||||
LWIP_UNUSED_ARG(value_len);
|
LWIP_UNUSED_ARG(value_len);
|
||||||
|
|
||||||
|
/* udpEndpointLocalAddressType + udpEndpointLocalAddress */
|
||||||
index += snmp_oid_to_ip(&row_oid[index], row_oid_len-index, &local_ip);
|
index += snmp_oid_to_ip(&row_oid[index], row_oid_len-index, &local_ip);
|
||||||
if(index == 0) {
|
if(index == 0) {
|
||||||
return SNMP_ERR_NOSUCHINSTANCE;
|
return SNMP_ERR_NOSUCHINSTANCE;
|
||||||
}
|
}
|
||||||
/* @todo: OID length check + range check */
|
|
||||||
|
/* udpEndpointLocalPort */
|
||||||
|
if(row_oid_len < (index+1)) {
|
||||||
|
return SNMP_ERR_NOSUCHINSTANCE;
|
||||||
|
}
|
||||||
|
if(row_oid[index] > 0xffff) {
|
||||||
|
return SNMP_ERR_NOSUCHINSTANCE;
|
||||||
|
}
|
||||||
local_port = (u16_t)row_oid[index];
|
local_port = (u16_t)row_oid[index];
|
||||||
index++;
|
index++;
|
||||||
|
|
||||||
|
/* udpEndpointRemoteAddressType + udpEndpointRemoteAddress */
|
||||||
index += snmp_oid_to_ip(&row_oid[index], row_oid_len-index, &remote_ip);
|
index += snmp_oid_to_ip(&row_oid[index], row_oid_len-index, &remote_ip);
|
||||||
if(index == 0) {
|
if(index == 0) {
|
||||||
return SNMP_ERR_NOSUCHINSTANCE;
|
return SNMP_ERR_NOSUCHINSTANCE;
|
||||||
}
|
}
|
||||||
/* @todo: OID length check + range check */
|
|
||||||
|
/* udpEndpointRemotePort */
|
||||||
|
if(row_oid_len < (index+1)) {
|
||||||
|
return SNMP_ERR_NOSUCHINSTANCE;
|
||||||
|
}
|
||||||
|
if(row_oid[index] > 0xffff) {
|
||||||
|
return SNMP_ERR_NOSUCHINSTANCE;
|
||||||
|
}
|
||||||
remote_port = (u16_t)row_oid[index];
|
remote_port = (u16_t)row_oid[index];
|
||||||
index++;
|
index++;
|
||||||
|
|
||||||
/* check udpEndpointInstance */
|
/* udpEndpointInstance */
|
||||||
|
if(row_oid_len < (index+1)) {
|
||||||
|
return SNMP_ERR_NOSUCHINSTANCE;
|
||||||
|
}
|
||||||
if(row_oid[index] != 0) {
|
if(row_oid[index] != 0) {
|
||||||
return SNMP_ERR_NOSUCHINSTANCE;
|
return SNMP_ERR_NOSUCHINSTANCE;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user