1
0
mirror of https://github.com/rcornwell/sims.git synced 2026-04-16 08:27:01 +00:00

KA10: Clean up coverity errors.

This commit is contained in:
Richard Cornwell
2022-03-09 22:33:47 -05:00
parent 61cfecf1dc
commit c7ee63bb9e
2 changed files with 6 additions and 0 deletions

View File

@@ -1080,6 +1080,8 @@ void nia_packet_debug(struct nia_device *nia, const char *action,
case ICMP_PROTO:
icmp = (struct icmp *)payload;
len = ntohs(ip->ip_len) - (ip->ip_v_hl & 0xf) * 4;
if (len > 1500)
len = 1500;
sim_debug(DEBUG_ICMP, &nia_dev, "%s %s %d byte packet from %s to %s\n", action,
(icmp->type < sizeof(icmp_types)/sizeof(icmp_types[0])) ? icmp_types[icmp->type] : "", (int)len, src_ip, dst_ip);
if (len && (nia_dev.dctrl & DEBUG_ICMP))

View File

@@ -1508,6 +1508,8 @@ imp_packet_in(struct imp_device *imp)
int i;
char port_buffer[100];
struct udp_hdr udp_hdr;
if (l > 1500)
l = 1500;
/* Count out 4 commas */
for (i = nlen = 0; i < l && nlen < 4; i++) {
if (tcp_payload[i] == ',')
@@ -2098,6 +2100,8 @@ void imp_packet_debug(struct imp_device *imp, const char *action, ETH_PACK *pack
}
len = ntohs(ip->ip_len) - ((ip->ip_v_hl & 0xf) * 4 + (ntohs(tcp->flags) >> 12) * 4);
if (len > 1500)
len = 1500;
sim_debug(DEBUG_TCP, &imp_dev, "%s %s%s %d byte packet from %s:%s to %s:%s\n", action,
flags, *flags ? ":" : "", (int)len, src_ip, src_port, dst_ip, dst_port);
if (len && (imp_dev.dctrl & DEBUG_TCP))