Fix msg_opt_data
authorJoseph C. Lehner <joseph.c.lehner@gmail.com>
Sat, 13 Feb 2016 22:54:51 +0000 (23:54 +0100)
committerJoseph C. Lehner <joseph.c.lehner@gmail.com>
Sat, 13 Feb 2016 22:54:51 +0000 (23:54 +0100)
nmrp.c

diff --git a/nmrp.c b/nmrp.c
index 892873fa8ddd9235c21637d7d4c44f7f4c58a2ca..f307a9d564fed9a3f4cbb0ca1692a55dd2fe3ec2 100644 (file)
--- a/nmrp.c
+++ b/nmrp.c
@@ -218,6 +218,9 @@ static void *msg_opt_data(struct nmrp_msg *msg, int type, uint16_t *len)
 
        while (remaining > 0) {
                if (opt->type == type) {
+                       if (opt->len == NMRP_OPT_LEN) {
+                               return NULL;
+                       }
                        *len = opt->len - NMRP_OPT_LEN;
                        return (char*)&opt->val;
                }