diff options
-rw-r--r-- | epan/dissectors/packet-whois.c | 12 | ||||
-rw-r--r-- | epan/tvbuff.c | 12 | ||||
-rw-r--r-- | epan/tvbuff.h | 12 |
3 files changed, 20 insertions, 16 deletions
diff --git a/epan/dissectors/packet-whois.c b/epan/dissectors/packet-whois.c index 7e5870cc9f..3dda13ae20 100644 --- a/epan/dissectors/packet-whois.c +++ b/epan/dissectors/packet-whois.c @@ -61,11 +61,15 @@ dissect_whois(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, conversation = find_or_create_conversation(pinfo); whois_trans = (whois_transaction_t *)conversation_get_proto_data(conversation, proto_whois); if (whois_trans == NULL) { - gint newline; + gint linelen; whois_trans = wmem_new0(wmem_file_scope(), whois_transaction_t); - newline = tvb_find_guint8(tvb, 0, -1, '\n'); - if (newline != -1) - whois_trans->query = tvb_get_string_enc(wmem_file_scope(), tvb, 0, newline, ENC_ASCII|ENC_NA); + + /* + * Find the end of the first line. + */ + linelen = tvb_find_line_end(tvb, 0, -1, NULL, FALSE); + if (linelen != -1) + whois_trans->query = tvb_get_string_enc(wmem_file_scope(), tvb, 0, linelen, ENC_ASCII|ENC_NA); conversation_add_proto_data(conversation, proto_whois, whois_trans); } 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) diff --git a/epan/tvbuff.h b/epan/tvbuff.h index 6a048ed296..002cc13e53 100644 --- a/epan/tvbuff.h +++ b/epan/tvbuff.h @@ -762,9 +762,9 @@ WS_DLL_PUBLIC gboolean tvb_ascii_isprint(tvbuff_t *tvb, const gint offset, * if "deseg" 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.) */ WS_DLL_PUBLIC gint tvb_find_line_end(tvbuff_t *tvb, const gint offset, int len, gint *next_offset, const gboolean desegment); @@ -783,9 +783,9 @@ WS_DLL_PUBLIC gint tvb_find_line_end(tvbuff_t *tvb, const gint offset, int len, * 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. */ WS_DLL_PUBLIC gint tvb_find_line_end_unquoted(tvbuff_t *tvb, const gint offset, int len, gint *next_offset); |