Don't crash while fuzzing
authorJoseph C. Lehner <joseph.c.lehner@gmail.com>
Mon, 15 May 2017 07:03:55 +0000 (09:03 +0200)
committerJoseph C. Lehner <joseph.c.lehner@gmail.com>
Mon, 15 May 2017 07:03:55 +0000 (09:03 +0200)
nmrp.c
tftp.c

diff --git a/nmrp.c b/nmrp.c
index a25a78a2514b5fc724b2f568ef38f1c6fc546079..4501d63fa14fd5171a6638a10ee256e9e881584f 100644 (file)
--- a/nmrp.c
+++ b/nmrp.c
@@ -235,6 +235,8 @@ static void msg_mkconfack(struct nmrp_msg *msg, uint32_t ipaddr, uint32_t ipmask
 #define ethsock_recv(sock, buf, len) read(STDIN_FILENO, buf, len)
 #define ethsock_send(a, b, c) (0)
 #define ethsock_set_timeout(a, b) (0)
 #define ethsock_recv(sock, buf, len) read(STDIN_FILENO, buf, len)
 #define ethsock_send(a, b, c) (0)
 #define ethsock_set_timeout(a, b) (0)
+#define ethsock_arp_add(a, b, c, d) (0)
+#define ethsock_arp_del(a, b) (0)
 #define ethsock_ip_add(a, b, c, d) (0)
 #define ethsock_ip_del(a, b) (0)
 #define ethsock_close(a) (0)
 #define ethsock_ip_add(a, b, c, d) (0)
 #define ethsock_ip_del(a, b) (0)
 #define ethsock_close(a) (0)
diff --git a/tftp.c b/tftp.c
index bf74650b42340093dcc83339b0e98f3387447f23..5189cbff8b060975b77b676b40c17f4a79346719 100644 (file)
--- a/tftp.c
+++ b/tftp.c
@@ -273,6 +273,10 @@ static ssize_t tftp_sendto(int sock, char *pkt, size_t len,
 
 const char *leafname(const char *path)
 {
 
 const char *leafname(const char *path)
 {
+       if (!path) {
+               return NULL;
+       }
+
        const char *slash, *bslash;
 
        slash = strrchr(path, '/');
        const char *slash, *bslash;
 
        slash = strrchr(path, '/');