On 2009-12-17, Denis Doroshenko <denis.doroshe...@gmail.com> wrote:
> RFC2865 WRT Class field content says the following:
>
>       The String field is one or more octets.

So the RD_STRING is correct,

>       string    1-253 octets containing binary data (values 0 through
>                 255 decimal, inclusive).  Strings of length zero (0)
>                 MUST NOT be sent; omit the entire attribute instead.

and the same problem could occur with other strings. How about running
them through strvisx() instead?

Index: print-radius.c
===================================================================
RCS file: /cvs/src/usr.sbin/tcpdump/print-radius.c,v
retrieving revision 1.8
diff -u -p -r1.8 print-radius.c
--- print-radius.c      23 May 2006 21:57:15 -0000      1.8
+++ print-radius.c      19 Dec 2009 13:04:46 -0000
@@ -32,7 +32,9 @@
 #include <arpa/inet.h>
 
 #include <stdio.h>
+#include <stdlib.h>
 #include <string.h>
+#include <vis.h>
 
 /* RADIUS support for tcpdump, Thomas Ptacek <t...@enteract.com> */
 
@@ -206,6 +208,7 @@ static void r_print_address(int code, in
 
 static void r_print_string(int code, int len, const u_char *data) {
        char string[128];
+       char vis[128*4];
 
        if(!len) {
                fputs(" ?", stdout);
@@ -218,7 +221,8 @@ static void r_print_string(int code, int
        memset(string, 0, 128);
        memcpy(string, data, len);
 
-       fprintf(stdout, " %s", string);
+       strvisx(vis, string, len, 0);
+       fprintf(stdout, " %s", vis);
 }
 
 static void r_print_hex(int code, int len, const u_char *data) {

Reply via email to