From a81c8e57bfb3596c552d49cf66fa695e0391406d Mon Sep 17 00:00:00 2001 From: Guy Harris Date: Thu, 26 Dec 2019 02:55:27 -0800 Subject: Find the line ending using tvb_find_line_end(). tvb_find_line_end(), unlike a tvb_find_guint8() looking for an LF, returns a length that *doesn't* include the line ending, *regardless* of whether the line ends with CR-LF or just LF, so the query string we extract is just the query, without any of the line ending. Update some comments while we're at it to note that the "next_offset" pointer argument to tvb_find_line_end() and tvb_find_line_end_unquoted() can be NULL, in which case the offset *past* the line ending isn't returned. (We pass tvb_find_line_end() NULL in the aforementioned call, because, in that particular case, we don't care about the next line.) Change-Id: I1c9746e32c61a79f8cb636d577a2e14a07ecab17 Reviewed-on: https://code.wireshark.org/review/35566 Petri-Dish: Guy Harris Tested-by: Petri Dish Buildbot Reviewed-by: Guy Harris --- epan/tvbuff.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'epan/tvbuff.c') diff --git a/epan/tvbuff.c b/epan/tvbuff.c index 73cb88ef50..a5a8d24503 100644 --- a/epan/tvbuff.c +++ b/epan/tvbuff.c @@ -3503,9 +3503,9 @@ static ws_mempbrk_pattern pbrk_crlf; * if "desegment" is false, return the amount of data remaining in * the buffer. * - * Set "*next_offset" to the offset of the character past the line - * terminator, or past the end of the buffer if we don't find a line - * terminator. (It's not set if we return -1.) + * If "next_offset" is not NULL, set "*next_offset" to the offset of the + * character past the line terminator, or past the end of the buffer if + * we don't find a line terminator. (It's not set if we return -1.) */ gint tvb_find_line_end(tvbuff_t *tvb, const gint offset, int len, gint *next_offset, const gboolean desegment) @@ -3626,9 +3626,9 @@ static ws_mempbrk_pattern pbrk_crlf_dquote; * the end), or the amount of data remaining in the buffer if we don't * find a line terminator. * - * Set "*next_offset" to the offset of the character past the line - * terminator, or past the end of the buffer if we don't find a line - * terminator. + * If "next_offset" is not NULL, set "*next_offset" to the offset of the + * character past the line terminator, or past the end of the buffer if + * we don't find a line terminator. */ gint tvb_find_line_end_unquoted(tvbuff_t *tvb, const gint offset, int len, gint *next_offset) -- cgit v1.2.3