diff options
author | Guy Harris <guy@alum.mit.edu> | 2019-12-26 02:55:27 -0800 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2019-12-26 18:08:27 +0000 |
commit | a81c8e57bfb3596c552d49cf66fa695e0391406d (patch) | |
tree | 0ca896b9a7e56f3538367f5f2577016aaf00ef13 /epan/tvbuff.c | |
parent | f0be7f27d862a5f460b398693fe4731e7ed87aa8 (diff) |
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 <guy@alum.mit.edu>
Tested-by: Petri Dish Buildbot
Reviewed-by: Guy Harris <guy@alum.mit.edu>
Diffstat (limited to 'epan/tvbuff.c')
-rw-r--r-- | epan/tvbuff.c | 12 |
1 files changed, 6 insertions, 6 deletions
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) |