]> The Tcpdump Group git mirrors - libpcap/commitdiff
Fix more code not to rely on void * + integral value working.
authorGuy Harris <[email protected]>
Thu, 17 Oct 2019 07:15:10 +0000 (00:15 -0700)
committerGuy Harris <[email protected]>
Thu, 17 Oct 2019 07:15:10 +0000 (00:15 -0700)
Have the "raw" pointer in union thdr be a u_char pointer, have
RING_GET_FRAME_AT() return a u_char pointer, and have the pointer
variable used when setting up the pointer array be a u_char pointer.

pcap-linux.c

index 7fb064f8bbec6d8a0b54785e32a49689252462ad..f93972bb136d20866a886a8455713139ffc7583d 100644 (file)
@@ -279,11 +279,11 @@ union thdr {
 #ifdef HAVE_TPACKET3
        struct tpacket_block_desc       *h3;
 #endif
-       void                            *raw;
+       u_char                          *raw;
 };
 
 #ifdef HAVE_PACKET_RING
-#define RING_GET_FRAME_AT(h, offset) (((union thdr **)h->buffer)[(offset)])
+#define RING_GET_FRAME_AT(h, offset) (((u_char **)h->buffer)[(offset)])
 #define RING_GET_CURRENT_FRAME(h) RING_GET_FRAME_AT(h, h->offset)
 
 static void destroy_ring(pcap_t *handle);
@@ -4599,7 +4599,7 @@ retry:
        /* fill the header ring with proper frame ptr*/
        handle->offset = 0;
        for (i=0; i<req.tp_block_nr; ++i) {
-               void *base = &handlep->mmapbuf[i*req.tp_block_size];
+               u_char *base = &handlep->mmapbuf[i*req.tp_block_size];
                for (j=0; j<frames_per_block; ++j, ++handle->offset) {
                        RING_GET_CURRENT_FRAME(handle) = base;
                        base += req.tp_frame_size;