diff options
-rw-r--r-- | src/dgram/dgram_link.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/dgram/dgram_link.c b/src/dgram/dgram_link.c index 145e716..c1f4845 100644 --- a/src/dgram/dgram_link.c +++ b/src/dgram/dgram_link.c @@ -27,6 +27,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ +#include <sys/errno.h> #include <sys/socket.h> #include <netinet/in.h> #include <linux/if_packet.h> @@ -114,6 +115,10 @@ dgram_do_send(struct onet_link *link, struct dgram_params *params) static int squeak_back(struct onet_link *link, mac_addr_t src, mac_addr_t dst) { + if (link == NULL) { + return -EINVAL; + } + /* * If one were to spoof their address as the broadcast * address, that could end up VERY badly as it would @@ -139,6 +144,10 @@ dgram_send(struct onet_link *link, mac_addr_t dst, void *buf, uint16_t len) { struct dgram_params params; + if (link == NULL || buf == NULL) { + return -EINVAL; + } + params.dst = dst; params.buf = buf; params.len = len; @@ -152,6 +161,10 @@ dgram_squeak(struct onet_link *link, mac_addr_t dst) struct dgram_params params; uint8_t pad[8]; + if (link == NULL) { + return -EINVAL; + } + params.dst = dst; params.buf = pad; params.len = sizeof(pad); |