mirror of
https://github.com/emanuele-f/PCAPdroid.git
synced 2026-07-03 21:21:12 +08:00
Fix possible unaligned access
This commit is contained in:
parent
57b5107659
commit
1571980917
@ -85,10 +85,14 @@ static void max_pkts_per_flow() {
|
||||
zdtun_pkt_t pkt;
|
||||
zdtun_ip_t *expected_ip;
|
||||
zdtun_ip_t *remote_ip;
|
||||
zdtun_ip_t src_ip, dst_ip;
|
||||
|
||||
assert0(zdtun_parse_pkt(pd->zdt, (char*)buf, rec.incl_len, &pkt));
|
||||
src_ip = pkt.tuple.src_ip;
|
||||
dst_ip = pkt.tuple.dst_ip;
|
||||
|
||||
remote_ip = (zdtun_cmp_ip(4, &pkt.tuple.src_ip, &local_ip) == 0) ?
|
||||
&pkt.tuple.dst_ip : &pkt.tuple.src_ip;
|
||||
&dst_ip : &src_ip;
|
||||
|
||||
#if 0
|
||||
char ip[INET_ADDRSTRLEN];
|
||||
|
||||
@ -126,11 +126,12 @@ conn_and_tuple_t* assert_conn(pcapdroid_t *pd, int ipproto, const char *dst_ip,
|
||||
|
||||
for(int i=0; i < pd->new_conns.cur_items; i++) {
|
||||
conn_and_tuple_t *conn = &pd->new_conns.items[i];
|
||||
zdtun_ip_t dst_ip = conn->tuple.dst_ip;
|
||||
|
||||
if((conn->tuple.ipproto == ipproto) &&
|
||||
(conn->tuple.dst_port == dst_port) &&
|
||||
(conn->tuple.ipver == ipver) &&
|
||||
(!zdtun_cmp_ip(ipver, &conn->tuple.dst_ip, &ip)) &&
|
||||
(!zdtun_cmp_ip(ipver, &dst_ip, &ip)) &&
|
||||
((info == NULL) || ((conn->data->info != NULL) && !strcmp(info, conn->data->info)))) {
|
||||
found = conn;
|
||||
break;
|
||||
@ -259,4 +260,4 @@ static void free_payload_chunks(pcapdroid_t *pd) {
|
||||
}
|
||||
|
||||
free(chunks_lists_heads);
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user