X-Git-Url: https://git.tcpdump.org/tcpdump/blobdiff_plain/e3622fbd2b837a5413d90091b87b4a733573058f..532534b6366927708baa6dc8dcf62d8924ab5efc:/print-radius.c diff --git a/print-radius.c b/print-radius.c index 3018a5fb..682cad61 100644 --- a/print-radius.c +++ b/print-radius.c @@ -19,6 +19,9 @@ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. */ + +/* \summary: Radius protocol printer */ + /* * Radius printer routines as specified on: * @@ -56,11 +59,11 @@ #include "config.h" #endif -#include +#include #include -#include "interface.h" +#include "netdissect.h" #include "addrtoname.h" #include "extract.h" #include "oui.h" @@ -369,7 +372,8 @@ static const char *prompt[]={ "No Echo", }; -struct attrtype { const char *name; /* Attribute name */ +static struct attrtype { + const char *name; /* Attribute name */ const char **subtypes; /* Standard Values (if any) */ u_char siz_subtypes; /* Size of total standard values */ u_char first_subtype; /* First standard value is 0 or 1 */ @@ -492,10 +496,7 @@ print_attr_string(netdissect_options *ndo, { case TUNNEL_PASS: if (length < 3) - { - ND_PRINT((ndo, "%s", tstr)); - return; - } + goto trunc; if (*data && (*data <=0x1F) ) ND_PRINT((ndo, "Tag[%u] ", *data)); else @@ -515,10 +516,7 @@ print_attr_string(netdissect_options *ndo, if (*data <= 0x1F) { if (length < 1) - { - ND_PRINT((ndo, "%s", tstr)); - return; - } + goto trunc; if (*data) ND_PRINT((ndo, "Tag[%u] ", *data)); else @@ -528,6 +526,8 @@ print_attr_string(netdissect_options *ndo, } break; case EGRESS_VLAN_NAME: + if (length < 1) + goto trunc; ND_PRINT((ndo, "%s (0x%02x) ", tok2str(rfc4675_tagged,"Unknown tag",*data), *data)); @@ -536,8 +536,8 @@ print_attr_string(netdissect_options *ndo, break; } - for (i=0; *data && i < length ; i++, data++) - ND_PRINT((ndo, "%c", (*data < 32 || *data > 128) ? '.' : *data)); + for (i=0; i < length && *data; i++, data++) + ND_PRINT((ndo, "%c", (*data < 32 || *data > 126) ? '.' : *data)); return; @@ -597,7 +597,7 @@ print_vendor_attr(netdissect_options *ndo, vendor_type, vendor_length)); for (idx = 0; idx < vendor_length ; idx++, data++) - ND_PRINT((ndo, "%c", (*data < 32 || *data > 128) ? '.' : *data)); + ND_PRINT((ndo, "%c", (*data < 32 || *data > 126) ? '.' : *data)); length-=vendor_length; } return;