Ethereal-dev: [Ethereal-dev] [PATCH][WSP]Decoding of Quoted-string

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

From: Loïc Minier <lool+ethereal@xxxxxxxxxx>
Date: Mon, 17 Nov 2003 17:30:22 +0100
      Good evening list,

 Attached patch suppress the leading quote from a Quoted-string in WSP
 header-values.

 This is not a perfect fix, because we're supposed to parse a WSP
 Quoted-string as a RFC2616 Quoted-string.

 I suggest the same kind of patch for WSP Text-string starting with a
 WSP Quote (0x7f).

 Questions for Olivier, or any other packet-wsp.c interested person:
   - what about changing:
    "#define is_quoted_string(x)     is_text_string(x)"
 ... in packet-wsp.c to:
    "#define is_quoted_string(x)     ( (x == 34) )"
   - what is this for:
    "val_len++; /* For extra '\0' byte */"
 ... also in packet-wsp.c, about line 1740 after this patch
   - do you have a capture with x-wap-tod textually encoded followed by
     binary-encoded date?


     Kind regards,

-- 
Lo�c Minier <lool@xxxxxxxx>
Index: packet-wsp.c
===================================================================
RCS file: /cvsroot/ethereal/packet-wsp.c,v
retrieving revision 1.87
diff -u -b -r1.87 packet-wsp.c
--- packet-wsp.c	15 Nov 2003 23:58:53 -0000	1.87
+++ packet-wsp.c	17 Nov 2003 16:19:44 -0000
@@ -1729,6 +1729,9 @@
 			val_id = tvb_get_guint8(tvb, val_start);
 			/* Call header value dissector for given header */
 			if (val_id >= 0x20 && val_id <=0x7E) { /* OK! */
+				if (val_id == 34) { /* Quote */
+					val_start++;
+				}
 				/* Header value sometimes NOT NUL-ended => tvb_strnlen() */
 				val_len = tvb_strnlen(tvb, val_start, tvb_len - val_start);
 				if (val_len == -1) { /* Reached end-of-tvb before '\0' */
@@ -1858,7 +1861,10 @@
 
 #define wkh_2_TextualValue					/* Parse Textual Value */ \
 		/* END */ \
-	} else if ((val_id == 0) || (val_id >=0x20)) { /* Textual value */ \
+	} else if ((val_id == 0) || (val_id >= 0x20)) { /* Textual value */ \
+		if (val_id == 34) { /* Quote */ \
+			val_start++; \
+		} \
 		val_str = tvb_get_stringz (tvb, val_start, &val_len); \
 		g_assert(val_str); \
 		offset = val_start + val_len; \