提交 b765bd46 authored 作者: Andrey Volk's avatar Andrey Volk

FS-11903: Fix errors reported by PVS-Studio Static Code Analyzer for switch_stun.c

上级 b5d8ffcb
...@@ -809,26 +809,23 @@ SWITCH_DECLARE(switch_status_t) switch_stun_lookup(char **ip, ...@@ -809,26 +809,23 @@ SWITCH_DECLARE(switch_status_t) switch_stun_lookup(char **ip,
end_buf = buf + ((sizeof(buf) > packet->header.length) ? packet->header.length : sizeof(buf)); end_buf = buf + ((sizeof(buf) > packet->header.length) ? packet->header.length : sizeof(buf));
switch_stun_packet_first_attribute(packet, attr); switch_stun_packet_first_attribute(packet, attr);
switch_assert(attr);
do { do {
switch (attr->type) { switch (attr->type) {
case SWITCH_STUN_ATTR_MAPPED_ADDRESS: case SWITCH_STUN_ATTR_MAPPED_ADDRESS:
if (attr->type) { if (funny) {
if (funny) { switch_stun_ip_t *tmp = (switch_stun_ip_t *) attr->value;
switch_stun_ip_t *tmp = (switch_stun_ip_t *) attr->value; tmp->address ^= ntohl(0xabcdabcd);
tmp->address ^= ntohl(0xabcdabcd);
}
switch_stun_packet_attribute_get_mapped_address(attr, rip, sizeof(rip), &rport);
} }
switch_stun_packet_attribute_get_mapped_address(attr, rip, sizeof(rip), &rport);
break; break;
case SWITCH_STUN_ATTR_XOR_MAPPED_ADDRESS: case SWITCH_STUN_ATTR_XOR_MAPPED_ADDRESS:
if (attr->type) { switch_stun_packet_attribute_get_xor_mapped_address(attr, &packet->header, rip, sizeof(rip), &rport);
switch_stun_packet_attribute_get_xor_mapped_address(attr, &packet->header, rip, sizeof(rip), &rport);
}
break; break;
case SWITCH_STUN_ATTR_USERNAME: case SWITCH_STUN_ATTR_USERNAME:
if (attr->type) { switch_stun_packet_attribute_get_username(attr, username, 32);
switch_stun_packet_attribute_get_username(attr, username, 32);
}
break; break;
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论