aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--epan/dissectors/packet-catapult-dct2000.c2
-rw-r--r--epan/dissectors/packet-http.c4
-rw-r--r--epan/dissectors/packet-irc.c2
-rw-r--r--epan/dissectors/packet-l1-events.c2
-rw-r--r--epan/dissectors/packet-ldss.c2
-rw-r--r--epan/dissectors/packet-megaco.c5
-rw-r--r--epan/dissectors/packet-memcache.c6
-rw-r--r--epan/dissectors/packet-mgcp.c11
-rw-r--r--epan/dissectors/packet-mrcpv2.c2
-rw-r--r--epan/dissectors/packet-msrp.c4
-rw-r--r--epan/dissectors/packet-multipart.c4
-rw-r--r--epan/dissectors/packet-rtsp.c2
-rw-r--r--epan/dissectors/packet-sdp.c4
-rw-r--r--epan/dissectors/packet-sip.c2
-rw-r--r--epan/dissectors/packet-sipfrag.c2
-rw-r--r--epan/dissectors/packet-text-media.c2
16 files changed, 27 insertions, 29 deletions
diff --git a/epan/dissectors/packet-catapult-dct2000.c b/epan/dissectors/packet-catapult-dct2000.c
index d860c4c468..2c9c8e8113 100644
--- a/epan/dissectors/packet-catapult-dct2000.c
+++ b/epan/dissectors/packet-catapult-dct2000.c
@@ -1910,7 +1910,7 @@ static void dissect_tty_lines(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tre
tty_tree = proto_item_add_subtree(ti, ett_catapult_dct2000_tty);
/* Show the tty lines one at a time. */
- while (tvb_reported_length_remaining(tvb, offset) > 0) {
+ while (tvb_offset_exists(tvb, offset)) {
/* Find the end of the line. */
int linelen = tvb_find_line_end_unquoted(tvb, offset, -1, &next_offset);
diff --git a/epan/dissectors/packet-http.c b/epan/dissectors/packet-http.c
index 16bb1dc016..4f4371ee8b 100644
--- a/epan/dissectors/packet-http.c
+++ b/epan/dissectors/packet-http.c
@@ -843,7 +843,7 @@ dissect_http_message(tvbuff_t *tvb, int offset, packet_info *pinfo,
headers.transfer_encoding = NULL; /* transfer encoding not known yet */
headers.upgrade = 0; /* assume we're not upgrading */
saw_req_resp_or_header = FALSE; /* haven't seen anything yet */
- while (tvb_reported_length_remaining(tvb, offset) > 0) {
+ while (tvb_offset_exists(tvb, offset)) {
/*
* Find the end of the line.
* XXX - what if we don't find it because the packet
@@ -3426,7 +3426,7 @@ dissect_message_http(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
ti = proto_tree_add_item(tree, proto_message_http,
tvb, 0, -1, ENC_NA);
subtree = proto_item_add_subtree(ti, ett_message_http);
- while (tvb_reported_length_remaining(tvb, offset) > 0) {
+ while (tvb_offset_exists(tvb, offset)) {
len = tvb_find_line_end(tvb, offset,
tvb_ensure_captured_length_remaining(tvb, offset),
&next_offset, FALSE);
diff --git a/epan/dissectors/packet-irc.c b/epan/dissectors/packet-irc.c
index 257796daba..fcf7f12d84 100644
--- a/epan/dissectors/packet-irc.c
+++ b/epan/dissectors/packet-irc.c
@@ -469,7 +469,7 @@ dissect_irc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
/*
* Process the packet data, a line at a time.
*/
- while (tvb_reported_length_remaining(tvb, offset) > 0)
+ while (tvb_offset_exists(tvb, offset))
{
/*
* Find the end of the line.
diff --git a/epan/dissectors/packet-l1-events.c b/epan/dissectors/packet-l1-events.c
index aad33f3651..cbb87f0a46 100644
--- a/epan/dissectors/packet-l1-events.c
+++ b/epan/dissectors/packet-l1-events.c
@@ -83,7 +83,7 @@ dissect_l1_events(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* dat
proto_item_append_text(ti, ": %s", data_name);
subtree = proto_item_add_subtree(ti, ett_l1_events);
/* Read the media line by line */
- while (tvb_reported_length_remaining(tvb, offset) != 0) {
+ while (tvb_offset_exists(tvb, offset)) {
/*
* XXX - we need to be passed the parameters
* of the content type via data parameter,
diff --git a/epan/dissectors/packet-ldss.c b/epan/dissectors/packet-ldss.c
index b72f6768f6..7e5b4f06ec 100644
--- a/epan/dissectors/packet-ldss.c
+++ b/epan/dissectors/packet-ldss.c
@@ -510,7 +510,7 @@ dissect_ldss_transfer (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void
/* Grab each line from the packet, there should be 4 but lets
* not walk off the end looking for more. */
- while (offset < tvb_reported_length(tvb)) {
+ while (tvb_offset_exists(tvb, offset)) {
gint next_offset;
const guint8 *line;
int linelen;
diff --git a/epan/dissectors/packet-megaco.c b/epan/dissectors/packet-megaco.c
index c6e243c9b3..b80ed25505 100644
--- a/epan/dissectors/packet-megaco.c
+++ b/epan/dissectors/packet-megaco.c
@@ -3226,10 +3226,9 @@ dissect_megaco_LocalControldescriptor(tvbuff_t *tvb, proto_tree *megaco_mediades
static void tvb_raw_text_add(tvbuff_t *tvb, proto_tree *tree){
- gint tvb_linebegin,tvb_lineend,tvb_len,linelen;
+ gint tvb_linebegin,tvb_lineend,linelen;
tvb_linebegin = 0;
- tvb_len = tvb_reported_length(tvb);
proto_tree_add_text(tree, tvb, 0, -1,"-------------- (RAW text output) ---------------");
@@ -3239,7 +3238,7 @@ static void tvb_raw_text_add(tvbuff_t *tvb, proto_tree *tree){
"%s", tvb_format_text_wsp(tvb,tvb_linebegin,
linelen));
tvb_linebegin = tvb_lineend;
- } while ( tvb_lineend < tvb_len && linelen > 0);
+ } while (tvb_offset_exists(tvb, tvb_lineend) && linelen > 0);
}
/*
diff --git a/epan/dissectors/packet-memcache.c b/epan/dissectors/packet-memcache.c
index 38fe389ea6..b969d3c47d 100644
--- a/epan/dissectors/packet-memcache.c
+++ b/epan/dissectors/packet-memcache.c
@@ -1003,7 +1003,7 @@ incr_dissector (tvbuff_t *tvb, proto_tree *tree, int offset)
int tokenlen;
/* expecting to read 'bytes' number of bytes from the buffer. */
- if (tvb_reported_length_remaining (tvb, offset) != 0) {
+ if (tvb_offset_exists (tvb, offset)) {
/* Find the end of the line. */
linelen = tvb_find_line_end (tvb, offset,
tvb_ensure_length_remaining (tvb, offset), &next_offset,
@@ -1054,7 +1054,7 @@ stat_dissector (tvbuff_t *tvb, proto_tree *tree, int offset)
guint32 slabclass;
guchar response_chars[21];
- while (tvb_reported_length_remaining (tvb, offset) != 0) {
+ while (tvb_offset_exists (tvb, offset)) {
/* Find the end of the line. */
linelen = tvb_find_line_end (tvb, offset,
tvb_ensure_length_remaining (tvb, offset), &next_offset,
@@ -1167,7 +1167,7 @@ get_response_dissector (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int
gchar response_chars[21]; /* cover uint64 (20 + 1) bytes*/
/* expecting to read 'bytes' number of bytes from the buffer. */
- while (tvb_reported_length_remaining (tvb, offset) != 0) {
+ while (tvb_offset_exists (tvb, offset)) {
/* Find the end of the line. */
linelen = tvb_find_line_end (tvb, offset,
tvb_ensure_length_remaining (tvb, offset), &next_offset,
diff --git a/epan/dissectors/packet-mgcp.c b/epan/dissectors/packet-mgcp.c
index 7a7fc7cd44..aabe2a3915 100644
--- a/epan/dissectors/packet-mgcp.c
+++ b/epan/dissectors/packet-mgcp.c
@@ -557,10 +557,9 @@ static void dissect_mgcp_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *
*/
static void mgcp_raw_text_add(tvbuff_t *tvb, proto_tree *tree)
{
- gint tvb_linebegin, tvb_lineend, tvb_len, linelen;
+ gint tvb_linebegin, tvb_lineend, linelen;
tvb_linebegin = 0;
- tvb_len = tvb_reported_length(tvb);
do
{
@@ -568,7 +567,7 @@ static void mgcp_raw_text_add(tvbuff_t *tvb, proto_tree *tree)
linelen = tvb_lineend - tvb_linebegin;
proto_tree_add_format_text(tree, tvb, tvb_linebegin, linelen);
tvb_linebegin = tvb_lineend;
- } while (tvb_lineend < tvb_len);
+ } while (tvb_offset_exists(tvb, tvb_lineend));
}
/* Discard and init any state we've saved */
@@ -1150,7 +1149,7 @@ static void dissect_mgcp_firstline(tvbuff_t *tvb, packet_info *pinfo, proto_tree
tvb_current_len);
}
tokennum++;
- } while (tvb_current_offset < tvb_len && tvb_previous_offset < tvb_len && tokennum <= 3);
+ } while (tvb_current_offset < tvb_len && tvb_offset_exists(tvb, tvb_current_offset) && tvb_previous_offset < tvb_len && tokennum <= 3);
switch (mgcp_type)
{
@@ -1419,7 +1418,7 @@ static void dissect_mgcp_params(tvbuff_t *tvb, proto_tree *tree)
mgcp_param_tree = proto_item_add_subtree(mgcp_param_ti, ett_mgcp_param);
/* Parse the parameters */
- while (tvb_lineend < tvb_len)
+ while (tvb_offset_exists(tvb, tvb_lineend))
{
old_lineend = tvb_lineend;
linelen = tvb_find_line_end(tvb, tvb_linebegin, -1, &tvb_lineend, FALSE);
@@ -1790,7 +1789,7 @@ static gint tvb_find_null_line(tvbuff_t* tvb, gint offset, gint len, gint* next_
tvb_current_len = tvb_reported_length_remaining(tvb, tvb_linebegin);
tvb_find_line_end(tvb, tvb_linebegin, tvb_current_len, &tvb_lineend, FALSE);
tempchar = tvb_get_guint8(tvb, tvb_linebegin);
- } while (tempchar != '\r' && tempchar != '\n' && tvb_lineend <= maxoffset);
+ } while (tempchar != '\r' && tempchar != '\n' && tvb_lineend <= maxoffset && tvb_offset_exists(tvb, tvb_lineend));
*next_offset = tvb_lineend;
diff --git a/epan/dissectors/packet-mrcpv2.c b/epan/dissectors/packet-mrcpv2.c
index 4709455ca9..6547f60543 100644
--- a/epan/dissectors/packet-mrcpv2.c
+++ b/epan/dissectors/packet-mrcpv2.c
@@ -609,7 +609,7 @@ dissect_mrcpv2_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
/* process the rest of the header lines here */
content_length = 0;
- while (next_offset < tvb_len)
+ while (tvb_offset_exists(tvb, next_offset))
{
/* get next line */
offset = next_offset;
diff --git a/epan/dissectors/packet-msrp.c b/epan/dissectors/packet-msrp.c
index 045e2be3c8..6fa82111d0 100644
--- a/epan/dissectors/packet-msrp.c
+++ b/epan/dissectors/packet-msrp.c
@@ -393,7 +393,7 @@ find_end_line(tvbuff_t *tvb, gint start)
{
gint offset = start, next_offset, linelen;
- while (tvb_length_remaining(tvb, offset) > 0) {
+ while (tvb_offset_exists(tvb, offset)) {
/* 'desegment' is FALSE so will set next_offset to beyond the end of
the buffer if no line ending is found */
linelen = tvb_find_line_end(tvb, offset, -1, &next_offset, FALSE);
@@ -583,7 +583,7 @@ dissect_msrp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_
/*
* Process the headers
*/
- while (tvb_reported_length_remaining(tvb, offset) > 0 && offset < end_line_offset ) {
+ while (tvb_offset_exists(tvb, offset) && offset < end_line_offset ) {
/* 'desegment' is FALSE so will set next_offset to beyond the end of
the buffer if no line ending is found */
linelen = tvb_find_line_end(tvb, offset, -1, &next_offset, FALSE);
diff --git a/epan/dissectors/packet-multipart.c b/epan/dissectors/packet-multipart.c
index bd3a0f22cc..4e90e454a0 100644
--- a/epan/dissectors/packet-multipart.c
+++ b/epan/dissectors/packet-multipart.c
@@ -454,7 +454,7 @@ find_first_boundary(tvbuff_t *tvb, gint start, const guint8 *boundary,
{
gint offset = start, next_offset, line_len, boundary_start;
- while (tvb_reported_length_remaining(tvb, offset + 2 + boundary_len) > 0) {
+ while (tvb_offset_exists(tvb, offset + 2 + boundary_len)) {
boundary_start = offset;
if (((tvb_strneql(tvb, offset, (const guint8 *)"--", 2) == 0)
&& (tvb_strneql(tvb, offset + 2, boundary, boundary_len) == 0)))
@@ -500,7 +500,7 @@ find_next_boundary(tvbuff_t *tvb, gint start, const guint8 *boundary,
{
gint offset = start, next_offset, line_len, boundary_start;
- while (tvb_reported_length_remaining(tvb, offset + 2 + boundary_len) > 0) {
+ while (tvb_offset_exists(tvb, offset + 2 + boundary_len)) {
line_len = tvb_find_line_end(tvb, offset, -1, &next_offset, FALSE);
if (line_len == -1) {
return -1;
diff --git a/epan/dissectors/packet-rtsp.c b/epan/dissectors/packet-rtsp.c
index 0a33976382..94bffb3466 100644
--- a/epan/dissectors/packet-rtsp.c
+++ b/epan/dissectors/packet-rtsp.c
@@ -833,7 +833,7 @@ dissect_rtspmessage(tvbuff_t *tvb, int offset, packet_info *pinfo,
* Process the packet data, a line at a time.
*/
saw_req_resp_or_header = FALSE; /* haven't seen anything yet */
- while (tvb_reported_length_remaining(tvb, offset) != 0) {
+ while (tvb_offset_exists(tvb, offset)) {
/*
* We haven't yet concluded that this is a header.
*/
diff --git a/epan/dissectors/packet-sdp.c b/epan/dissectors/packet-sdp.c
index d0fb766c92..6b77ae924c 100644
--- a/epan/dissectors/packet-sdp.c
+++ b/epan/dissectors/packet-sdp.c
@@ -1974,7 +1974,7 @@ setup_sdp_transport(tvbuff_t *tvb, packet_info *pinfo, enum sdp_exchange_type ex
/*
* Show the SDP message a line at a time.
*/
- while (tvb_reported_length_remaining(tvb, offset) > 0) {
+ while (tvb_offset_exists(tvb, offset)) {
/*
* Find the end of the line.
*/
@@ -2329,7 +2329,7 @@ dissect_sdp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
*/
in_media_description = FALSE;
- while (tvb_reported_length_remaining(tvb, offset) > 0) {
+ while (tvb_offset_exists(tvb, offset)) {
/*
* Find the end of the line.
*/
diff --git a/epan/dissectors/packet-sip.c b/epan/dissectors/packet-sip.c
index ba0fa99df2..ce59cec9a6 100644
--- a/epan/dissectors/packet-sip.c
+++ b/epan/dissectors/packet-sip.c
@@ -2732,7 +2732,7 @@ dissect_sip_common(tvbuff_t *tvb, int offset, int remaining_length, packet_info
if(tvb_reported_length_remaining(tvb, next_offset) <= 0){
is_no_header_termination = TRUE;
}else{
- while ((c = tvb_get_guint8(tvb, next_offset)) == ' ' || c == '\t')
+ while (tvb_offset_exists(tvb, next_offset) && ((c = tvb_get_guint8(tvb, next_offset)) == ' ' || c == '\t'))
{
/*
* This line end is not a header seperator.
diff --git a/epan/dissectors/packet-sipfrag.c b/epan/dissectors/packet-sipfrag.c
index 43a70aa786..36aed3f143 100644
--- a/epan/dissectors/packet-sipfrag.c
+++ b/epan/dissectors/packet-sipfrag.c
@@ -65,7 +65,7 @@ static void dissect_sipfrag(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
sipfrag_tree = proto_item_add_subtree(ti, ett_sipfrag);
/* Show the sipfrag message a line at a time. */
- while (tvb_reported_length_remaining(tvb, offset) > 0)
+ while (tvb_offset_exists(tvb, offset))
{
/* Find the end of the line. */
linelen = tvb_find_line_end_unquoted(tvb, offset, -1, &next_offset);
diff --git a/epan/dissectors/packet-text-media.c b/epan/dissectors/packet-text-media.c
index 4ad296a904..c3aa7ee9ec 100644
--- a/epan/dissectors/packet-text-media.c
+++ b/epan/dissectors/packet-text-media.c
@@ -98,7 +98,7 @@ dissect_text_lines(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* da
proto_item_append_text(ti, ": %s", data_name);
subtree = proto_item_add_subtree(ti, ett_text_lines);
/* Read the media line by line */
- while (tvb_reported_length_remaining(tvb, offset) != 0) {
+ while (tvb_offset_exists(tvb, offset)) {
/*
* XXX - we need to be passed the parameters
* of the content type via data parameter,