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-bt-monitor-linux.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-bt-monitor-linux.c')
-rw-r--r-- | pcap-bt-monitor-linux.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/pcap-bt-monitor-linux.c b/pcap-bt-monitor-linux.c index 206e65b5..3d4f0b08 100644 --- a/pcap-bt-monitor-linux.c +++ b/pcap-bt-monitor-linux.c @@ -102,7 +102,7 @@ bt_monitor_read(pcap_t *handle, int max_packets _U_, pcap_handler callback, u_ch u_char *pktd; struct hci_mon_hdr hdr; - pktd = (u_char *)handle->buffer + BT_CONTROL_SIZE; + pktd = handle->buffer + BT_CONTROL_SIZE; bthdr = (pcap_bluetooth_linux_monitor_header*)(void *)pktd; iv[0].iov_base = &hdr; |