aboutsummaryrefslogtreecommitdiff
path: root/pcap-snit.c
diff options
context:
space:
mode:
authorFrancois-Xavier Le Bail <devel.fx.lebail@orange.fr>2023-05-16 15:21:11 +0200
committerfxlb <devel.fx.lebail@orange.fr>2023-05-18 09:51:11 +0000
commitf8e510aaefcb0c229ce72116c3b6902bf2e3da63 (patch)
tree4cd980faa1da2fabdcce38ec80a9ec5f8156232b /pcap-snit.c
parentc7b90298984c46d820d3cee79a96d24870b5f200 (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-snit.c')
-rw-r--r--pcap-snit.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/pcap-snit.c b/pcap-snit.c
index 3f4e69d7..0bd4dabe 100644
--- a/pcap-snit.c
+++ b/pcap-snit.c
@@ -133,7 +133,7 @@ pcap_read_snit(pcap_t *p, int cnt, pcap_handler callback, u_char *user)
errno, "pcap_read");
return (-1);
}
- bp = (u_char *)p->buffer;
+ bp = p->buffer;
} else
bp = p->bp;