]> The Tcpdump Group git mirrors - tcpdump/blobdiff - print-aodv.c
change make check to work with POSIX shell
[tcpdump] / print-aodv.c
index db293bb6231bfc16c729a78dd1e78193a94bc8c4..fe75db863c0b21ad07cac931ec464f85d0b1fa84 100644 (file)
@@ -30,6 +30,8 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 
+/* \summary: Ad hoc On-Demand Distance Vector (AODV) Routing printer */
+
 #ifdef HAVE_CONFIG_H
 #include "config.h"
 #endif
@@ -40,7 +42,9 @@
 #include "addrtoname.h"
 #include "extract.h"
 
-
+/*
+ * RFC 3561
+ */
 struct aodv_rreq {
        uint8_t         rreq_type;      /* AODV message type (1) */
        uint8_t         rreq_flags;     /* various flags */
@@ -176,12 +180,17 @@ aodv_extension(netdissect_options *ndo,
 {
        const struct aodv_hello *ah;
 
+       ND_TCHECK(*ep);
        switch (ep->type) {
        case AODV_EXT_HELLO:
                ah = (const struct aodv_hello *)(const void *)ep;
                ND_TCHECK(*ah);
                if (length < sizeof(struct aodv_hello))
                        goto trunc;
+               if (ep->length < 4) {
+                       ND_PRINT((ndo, "\n\text HELLO - bad length %u", ep->length));
+                       break;
+               }
                ND_PRINT((ndo, "\n\text HELLO %ld ms",
                    (unsigned long)EXTRACT_32BITS(&ah->interval)));
                break;