diff options
author | Guy Harris <guy@alum.mit.edu> | 2017-03-19 15:13:57 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-03-19 15:13:57 -0700 |
commit | 99ab600b192f5971cb76f925f41015c100b44e4d (patch) | |
tree | 9dd75a7fb2911e4b0f541b0f2e1bd67dde3293b6 /pcap-win32.c | |
parent | c4b0e2bd57a234f474b061db5b96950bf5a81a5d (diff) | |
parent | 7249af7a9ed911ca76aed069c421bb3d7b55ec3e (diff) |
Merge pull request #568 from gvanem/master
MSVC's strdup() in _DEBUG mode
Diffstat (limited to 'pcap-win32.c')
-rw-r--r-- | pcap-win32.c | 25 |
1 files changed, 10 insertions, 15 deletions
diff --git a/pcap-win32.c b/pcap-win32.c index e554ae01..984774cf 100644 --- a/pcap-win32.c +++ b/pcap-win32.c @@ -464,6 +464,11 @@ pcap_live_dump_win32(pcap_t *p, char *filename, int maxsize, int maxpacks) /* Set the limits of the dump file */ res = PacketSetDumpLimits(p->adapter, maxsize, maxpacks); + if(res == FALSE) { + pcap_snprintf(p->errbuf, PCAP_ERRBUF_SIZE, + "Error setting dump limit"); + return (-1); + } return (0); } @@ -821,26 +826,16 @@ pcap_read_win32_dag(pcap_t *p, int cnt, pcap_handler callback, u_char *user) /* Send a packet to the network */ static int -pcap_inject_win32(pcap_t *p, const void *buf, size_t size){ - LPPACKET PacketToSend; - - PacketToSend=PacketAllocatePacket(); - - if (PacketToSend == NULL) - { - pcap_snprintf(p->errbuf, PCAP_ERRBUF_SIZE, "send error: PacketAllocatePacket failed"); - return (-1); - } +pcap_inject_win32(pcap_t *p, const void *buf, size_t size) +{ + PACKET pkt; - PacketInitPacket(PacketToSend, (PVOID)buf, (UINT)size); - if(PacketSendPacket(p->adapter,PacketToSend,TRUE) == FALSE){ + PacketInitPacket(&pkt, (PVOID)buf, size); + if(PacketSendPacket(p->adapter,&pkt,TRUE) == FALSE) { pcap_snprintf(p->errbuf, PCAP_ERRBUF_SIZE, "send error: PacketSendPacket failed"); - PacketFreePacket(PacketToSend); return (-1); } - PacketFreePacket(PacketToSend); - /* * We assume it all got sent if "PacketSendPacket()" succeeded. * "pcap_inject()" is expected to return the number of bytes |