summaryrefslogtreecommitdiff
path: root/udp.c
diff options
context:
space:
mode:
authorHåkon Nessjøen <haakon.nessjoen@gmail.com>2010-09-27 16:46:07 +0200
committerHåkon Nessjøen <haakon.nessjoen@gmail.com>2010-09-27 16:46:07 +0200
commit86460e9be93df399286e63b8142853d6e5aee5a9 (patch)
tree40da281840101f425f0e20b1fea5e6f719f34dc0 /udp.c
parentee5e037df930a4a877cd5de865dd884b3d83814f (diff)
downloadMAC-Telnet-86460e9be93df399286e63b8142853d6e5aee5a9.tar.gz
MAC-Telnet-86460e9be93df399286e63b8142853d6e5aee5a9.zip
Minifixes
Diffstat (limited to 'udp.c')
-rw-r--r--udp.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/udp.c b/udp.c
index e8e0861..0cfce5b 100644
--- a/udp.c
+++ b/udp.c
@@ -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);