Support for embedded newlines in SDP fields, from Robert Tsai.

svn path=/trunk/; revision=2584
This commit is contained in:
Guy Harris 2000-11-09 02:42:33 +00:00
parent b913b92354
commit 37ec8b1b32
4 changed files with 39 additions and 5 deletions

View File

@ -385,6 +385,7 @@ Wes Hardaker <wjhardaker@ucdavis.edu> {
Robert Tsai <rtsai@netapp.com> {
Rsh support
Support for embedded newlines in SDP fields
}
Craig Metz <cmetz@inner.net> {

View File

@ -1,7 +1,7 @@
/* strutil.c
* String utility routines
*
* $Id: strutil.c,v 1.3 2000/09/30 05:44:48 guy Exp $
* $Id: strutil.c,v 1.4 2000/11/09 02:42:33 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@ -99,6 +99,36 @@ find_line_end(const u_char *data, const u_char *dataend, const u_char **eol)
return lineend;
}
const u_char *
find_line_end_unquoted(const u_char *data, const u_char *dataend,
const u_char **eol)
{
const u_char *pp;
gboolean is_quoted;
pp = data;
is_quoted = FALSE;
*eol = NULL;
for (pp = data, is_quoted = FALSE; pp < dataend; pp++) {
if (*pp == '\n') {
if (is_quoted) {
/* Do nothing. Wait for next quote. */
} else {
*eol = (pp > data && *(pp - 1) == '\r')
? pp - 1
: pp;
pp++;
break;
}
} else if (*pp == '"') {
is_quoted = !is_quoted;
}
}
if (!*eol)
*eol = pp;
return pp;
}
/*
* Get the length of the next token in a line, and the beginning of the
* next token after that (if any).

View File

@ -1,7 +1,7 @@
/* strutil.h
* String utility definitions
*
* $Id: strutil.h,v 1.2 2000/09/28 03:16:17 gram Exp $
* $Id: strutil.h,v 1.3 2000/11/09 02:42:33 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@ -38,6 +38,8 @@
const u_char *find_line_end(const u_char *data, const u_char *dataend,
const u_char **eol);
const u_char *find_line_end_unquoted(const u_char *data, const u_char *dataend,
const u_char **eol);
int get_token_len(const u_char *linep, const u_char *lineend,
const u_char **next_token);
gchar* format_text(const u_char *line, int len);

View File

@ -4,7 +4,7 @@
* Jason Lango <jal@netapp.com>
* Liberally copied from packet-http.c, by Guy Harris <guy@alum.mit.edu>
*
* $Id: packet-sdp.c,v 1.10 2000/09/11 16:16:03 gram Exp $
* $Id: packet-sdp.c,v 1.11 2000/11/09 02:42:31 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@ -75,7 +75,8 @@ void dissect_sdp(const u_char *pd, int offset, frame_data *fd,
if (!tree)
return;
ti = proto_tree_add_item(tree, proto_sdp, NullTVB, offset, END_OF_FRAME, FALSE);
ti = proto_tree_add_item(tree, proto_sdp, NullTVB, offset,
END_OF_FRAME, FALSE);
sdp_tree = proto_item_add_subtree(ti, ett_sdp);
section = 0;
@ -83,7 +84,7 @@ void dissect_sdp(const u_char *pd, int offset, frame_data *fd,
/*
* Find the end of the line.
*/
lineend = find_line_end(data, dataend, &eol);
lineend = find_line_end_unquoted(data, dataend, &eol);
linelen = lineend - data;
/*