diff options
author | Francois-Xavier Le Bail <devel.fx.lebail@orange.fr> | 2023-05-16 15:21:11 +0200 |
---|---|---|
committer | fxlb <devel.fx.lebail@orange.fr> | 2023-05-18 09:51:11 +0000 |
commit | f8e510aaefcb0c229ce72116c3b6902bf2e3da63 (patch) | |
tree | 4cd980faa1da2fabdcce38ec80a9ec5f8156232b /pcap-rdmasniff.c | |
parent | c7b90298984c46d820d3cee79a96d24870b5f200 (diff) |
struct pcap: Update buffer type from "void *" to "u_char *"
This change should avoid these cppcheck warnings:
pcap-hurd.c:77:18: warning: 'p->buffer' is of type 'void *'. When using
void pointers in calculations, the behaviour is undefined.
[arithOperationsOnVoidPointer]
pkt = p->buffer + offsetof(struct net_rcv_msg, packet)
^
pcap-hurd.c:78:8: warning: 'p->buffer+offsetof(struct net_rcv_msg,packet)'
is of type 'void *'. When using void pointers in calculations, the
behaviour is undefined. [arithOperationsOnVoidPointer]
+ sizeof(struct packet_header) - ETH_HLEN;
^
pcap-hurd.c:79:25: warning: 'p->buffer' is of type 'void *'. When using
void pointers in calculations, the behaviour is undefined.
[arithOperationsOnVoidPointer]
memmove(pkt, p->buffer + offsetof(struct net_rcv_msg, header),
^
Remove some '(u_char *)' casts accordingly.
Diffstat (limited to 'pcap-rdmasniff.c')
-rw-r--r-- | pcap-rdmasniff.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/pcap-rdmasniff.c b/pcap-rdmasniff.c index d63ca898..624828c0 100644 --- a/pcap-rdmasniff.c +++ b/pcap-rdmasniff.c @@ -169,7 +169,7 @@ rdmasniff_read(pcap_t *handle, int max_packets, pcap_handler callback, u_char *u pkth.caplen = min(pkth.len, (u_int)handle->snapshot); gettimeofday(&pkth.ts, NULL); - pktd = (u_char *) handle->buffer + wc.wr_id * RDMASNIFF_RECEIVE_SIZE; + pktd = handle->buffer + wc.wr_id * RDMASNIFF_RECEIVE_SIZE; if (handle->fcode.bf_insns == NULL || pcap_filter(handle->fcode.bf_insns, pktd, pkth.len, pkth.caplen)) { |