Re: tcpdump "kills" terminal by dumping RADIUS traffic

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Stuart Henderson
Date: Saturday, December 19, 2009 - 6:06 am

On 2009-12-17, Denis Doroshenko <denis.doroshenko@gmail.com> wrote:

So the RD_STRING is correct,


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 <tqbf@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) {
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
Re: tcpdump "kills" terminal by dumping RADIUS traffic, Stuart Henderson, (Sat Dec 19, 6:06 am)