Ethereal-dev: Re: [Ethereal-dev] [PATCH] packet-radius.c

Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.

From: Kan Sasaki <sasaki@xxxxxxxxx>
Date: Tue, 14 May 2002 19:21:29 +0900 (JST)
Hi,

> 	2) I didn't check in the change to "epan/value_string.c" -
> 	   instead, I changed the RADIUS code not to pass null pointers,
> 	   but to just print the numerical value if there's no
> 	   value_string table.

OK. I've changed as the following. Please find this patch.

Regards,

Index: packet-radius.c
===================================================================
RCS file: /cvsroot/ethereal/packet-radius.c,v
retrieving revision 1.60
diff -u -r1.60 packet-radius.c
--- packet-radius.c	2002/05/14 09:24:27	1.60
+++ packet-radius.c	2002/05/14 10:11:25
@@ -2306,13 +2306,9 @@
 	    break;
 	}
     }
-    if (vs != NULL)
-	sprintf(dest, "%s(%u)", rd_match_strval(val, vs), val);
-    else
-	sprintf(dest, "%u", val);
+    sprintf(dest, "%s(%u)", (vs ? rd_match_strval(val, vs) : "Undefined"), val);
 
     return dest;
-
 }
 
 static gchar *rd_value_to_str_2(gchar *dest, e_avphdr *avph, tvbuff_t *tvb,
@@ -2412,15 +2408,9 @@
 		    vsabuffer[vsa_index].str = cont;
 		    vsabuffer[vsa_index].offset = offset+vsa_len;
 		    vsabuffer[vsa_index].length = vsa_avph->avp_length;
-		    if (vsa_rvt != NULL) {
-			sprintf(cont, "t:%s(%u) l:%u, ",
-			    rd_match_strval_attrib(vsa_avph->avp_type,
-						   vsa_rvt->attrib),
-			    vsa_avph->avp_type, vsa_avph->avp_length);
-		    } else {
-			sprintf(cont, "t:%u l:%u, ",
+		    sprintf(cont, "t:%s(%u) l:%u, ",
+			    (vsa_rvt ? rd_match_strval_attrib(vsa_avph->avp_type, vsa_rvt->attrib) : "Unknown Type"),
 			    vsa_avph->avp_type, vsa_avph->avp_length);
-		    }
 		    cont = &cont[strlen(cont)];
 		    rd_value_to_str_2(cont, vsa_avph, tvb, offset+vsa_len,
 				      (vsa_rvt ? vsa_rvt->attrib : NULL));

-- 
Fusion Communications Corp.
Kan Sasaki  sasaki@xxxxxxxxx