1
0
mirror of https://passt.top/passt synced 2024-09-28 10:05:47 +00:00

tap, tcp: Fix two comparisons with different signedness reported by gcc 7

For some reason, those are not reported by recent versions of gcc.

Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
This commit is contained in:
Stefano Brivio 2021-10-26 00:35:01 +02:00
parent 6040f16239
commit f6d9787d30
2 changed files with 2 additions and 2 deletions

2
tap.c
View File

@ -340,7 +340,7 @@ resume:
iph = (struct iphdr *)(eh + 1); iph = (struct iphdr *)(eh + 1);
if ((iph->ihl * 4) + sizeof(*eh) > len) if ((iph->ihl * 4) + sizeof(*eh) > len)
continue; continue;
if (iph->ihl * 4 < sizeof(*iph)) if (iph->ihl * 4 < (int)sizeof(*iph))
continue; continue;
if (iph->saddr && c->addr4_seen != iph->saddr) { if (iph->saddr && c->addr4_seen != iph->saddr) {

2
tcp.c
View File

@ -1034,7 +1034,7 @@ static int tcp_opt_get(struct tcphdr *th, size_t len, uint8_t type_search,
uint8_t type, optlen; uint8_t type, optlen;
char *p; char *p;
if (len > th->doff * 4) if (len > (unsigned)th->doff * 4)
len = th->doff * 4; len = th->doff * 4;
len -= sizeof(*th); len -= sizeof(*th);