diff options
Diffstat (limited to 'udp.c')
-rw-r--r-- | udp.c | 6 |
1 files changed, 6 insertions, 0 deletions
@@ -8,6 +8,7 @@ #include <linux/in.h> #include <linux/udp.h> #include <linux/if_arp.h> +#include <stdlib.h> #include <stdio.h> unsigned short in_cksum(unsigned short *addr, int len) @@ -43,6 +44,11 @@ int sendCustomUDP(const int socket, const int ifindex, const unsigned char *sour static unsigned int id = 1; int send_result = 0; + if (buffer == NULL) { + perror("malloc"); + exit(1); + } + // Ethernet header memcpy(eh->h_source, sourcemac, ETH_ALEN); memcpy(eh->h_dest, destmac, ETH_ALEN); |