Use "tvb_offset_exists()" rather than "tvb_length_remaining()" to check

whether there's any data left in the tvbuff starting at a specified
offset.

svn path=/trunk/; revision=2636
This commit is contained in:
Guy Harris 2000-11-13 08:58:17 +00:00
parent ead1cadaf3
commit 9985115b8b
12 changed files with 28 additions and 28 deletions

View File

@ -1,7 +1,7 @@
/* packet-atalk.c
* Routines for Appletalk packet disassembly (DDP, currently).
*
* $Id: packet-atalk.c,v 1.42 2000/11/13 04:26:14 guy Exp $
* $Id: packet-atalk.c,v 1.43 2000/11/13 08:57:57 guy Exp $
*
* Simon Wilkinson <sxw@dcs.ed.ac.uk>
*
@ -262,7 +262,7 @@ dissect_rtmp_data(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) {
offset += 3 + nodelen;
i = 1;
while (tvb_length_remaining(tvb, offset) != 0) {
while (tvb_offset_exists(tvb, offset)) {
proto_tree *tuple_item, *tuple_tree;
guint16 tuple_net;
guint8 tuple_dist;

View File

@ -2,7 +2,7 @@
* Routines for ftp packet dissection
* Copyright 1999, Richard Sharpe <rsharpe@ns.aus.com>
*
* $Id: packet-ftp.c,v 1.21 2000/11/10 08:02:34 guy Exp $
* $Id: packet-ftp.c,v 1.22 2000/11/13 08:57:59 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@ -163,7 +163,7 @@ dissect_ftp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
* Show the rest of the request or response as text,
* a line at a time.
*/
while (tvb_length_remaining(tvb, offset)) {
while (tvb_offset_exists(tvb, offset)) {
/*
* Find the end of the line.
*/

View File

@ -3,7 +3,7 @@
*
* Guy Harris <guy@alum.mit.edu>
*
* $Id: packet-http.c,v 1.25 2000/11/09 10:56:31 guy Exp $
* $Id: packet-http.c,v 1.26 2000/11/13 08:58:01 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@ -107,7 +107,7 @@ dissect_http(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
/*
* Process the packet data, a line at a time.
*/
while (tvb_length_remaining(tvb, offset)) {
while (tvb_offset_exists(tvb, offset)) {
/*
* Find the end of the line.
*/

View File

@ -2,7 +2,7 @@
* Routines for NetBIOS over IPX packet disassembly
* Gilbert Ramirez <gram@xiexie.org>
*
* $Id: packet-nbipx.c,v 1.25 2000/11/10 21:29:27 gram Exp $
* $Id: packet-nbipx.c,v 1.26 2000/11/13 08:58:03 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@ -269,7 +269,7 @@ dissect_nbipx_dg(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
return;
offset += NETBIOS_NAME_LEN;
if (tvb_length_remaining(tvb, offset) != 0) {
if (tvb_offset_exists(tvb, offset)) {
next_tvb = tvb_new_subset(tvb, offset, -1, -1);
tvb_compat(next_tvb, &next_pd, &next_offset);
dissect_smb(next_pd, next_offset, pinfo->fd, tree,
@ -417,7 +417,7 @@ dissect_nwlink_dg(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
offset += 68;
if (tvb_length_remaining(tvb, offset) != 0) {
if (tvb_offset_exists(tvb, offset)) {
next_tvb = tvb_new_subset(tvb, offset, -1, -1);
switch (packet_type) {

View File

@ -2,7 +2,7 @@
* Routines for nntp packet dissection
* Copyright 1999, Richard Sharpe <rsharpe@ns.aus.com>
*
* $Id: packet-nntp.c,v 1.14 2000/11/09 10:56:32 guy Exp $
* $Id: packet-nntp.c,v 1.15 2000/11/13 08:58:05 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@ -105,7 +105,7 @@ dissect_nntp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
* matching request was, although the latter requires us to
* know what the matching request was....
*/
while (tvb_length_remaining(tvb, offset)) {
while (tvb_offset_exists(tvb, offset)) {
/*
* Find the end of the line.
*/

View File

@ -2,7 +2,7 @@
* Routines for pop packet dissection
* Copyright 1999, Richard Sharpe <rsharpe@ns.aus.com>
*
* $Id: packet-pop.c,v 1.18 2000/11/10 08:02:34 guy Exp $
* $Id: packet-pop.c,v 1.19 2000/11/13 08:58:07 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@ -166,7 +166,7 @@ dissect_pop(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
* Show the rest of the request or response as text,
* a line at a time.
*/
while (tvb_length_remaining(tvb, offset)) {
while (tvb_offset_exists(tvb, offset)) {
/*
* Find the end of the line.
*/

View File

@ -4,7 +4,7 @@
* Robert Tsai <rtsai@netapp.com>
* Liberally copied from packet-http.c, by Guy Harris <guy@alum.mit.edu>
*
* $Id: packet-rsh.c,v 1.5 2000/11/09 10:56:32 guy Exp $
* $Id: packet-rsh.c,v 1.6 2000/11/13 08:58:08 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@ -78,7 +78,7 @@ dissect_rsh(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
/*
* Process the packet data, a line at a time.
*/
while (tvb_length_remaining(tvb, offset)) {
while (tvb_offset_exists(tvb, offset)) {
/*
* Find the end of the line.
*/

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-rtsp.c,v 1.24 2000/11/12 21:23:53 guy Exp $
* $Id: packet-rtsp.c,v 1.25 2000/11/13 08:58:10 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@ -233,7 +233,7 @@ dissect_rtsp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
/*
* Process the packet data, a line at a time.
*/
while (tvb_length_remaining(tvb, offset)) {
while (tvb_offset_exists(tvb, offset)) {
/*
* Find the end of the line.
*/

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.14 2000/11/13 01:43:02 guy Exp $
* $Id: packet-sdp.c,v 1.15 2000/11/13 08:58:12 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@ -98,7 +98,7 @@ dissect_sdp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
* Show the SDP message a line at a time.
*/
section = 0;
while (tvb_length_remaining(tvb, offset)) {
while (tvb_offset_exists(tvb, offset)) {
/*
* Find the end of the line.
*/

View File

@ -1,7 +1,7 @@
/* packet-smtp.c
* Routines for SMTP packet disassembly
*
* $Id: packet-smtp.c,v 1.10 2000/11/12 03:13:44 guy Exp $
* $Id: packet-smtp.c,v 1.11 2000/11/13 08:58:13 guy Exp $
*
* Copyright (c) 2000 by Richard Sharpe <rsharpe@ns.aus.com>
*
@ -435,7 +435,7 @@ dissect_smtp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
* Message body.
* Put its lines into the protocol tree, a line at a time.
*/
while (tvb_length_remaining(tvb, offset) != 0) {
while (tvb_offset_exists(tvb, offset)) {
/*
* Find the end of the line.
@ -504,7 +504,7 @@ dissect_smtp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
* that doesn't have a continuation indication on it.
*/
while (tvb_length_remaining(tvb, offset) != 0) {
while (tvb_offset_exists(tvb, offset)) {
/*
* Find the end of the line.

View File

@ -2,7 +2,7 @@
* Routines for telnet packet dissection
* Copyright 1999, Richard Sharpe <rsharpe@ns.aus.com>
*
* $Id: packet-telnet.c,v 1.19 2000/11/12 00:59:07 guy Exp $
* $Id: packet-telnet.c,v 1.20 2000/11/13 08:58:15 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@ -305,7 +305,7 @@ telnet_add_text(proto_tree *tree, tvbuff_t *tvb, int offset, int len)
guint8 c;
gboolean last_char_was_cr;
while (len != 0 && tvb_length_remaining(tvb, offset) != 0) {
while (len != 0 && tvb_offset_exists(tvb, offset)) {
/*
* Find the end of the line.
*/
@ -329,7 +329,7 @@ telnet_add_text(proto_tree *tree, tvbuff_t *tvb, int offset, int len)
*/
if (tvb_get_guint8(tvb, offset + linelen) == '\r') {
last_char_was_cr = TRUE;
while (len != 0 && tvb_length_remaining(tvb, next_offset) != 0) {
while (len != 0 && tvb_offset_exists(tvb, next_offset)) {
c = tvb_get_guint8(tvb, next_offset);
next_offset++; /* skip over that character */
len--;
@ -386,7 +386,7 @@ dissect_telnet(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
/*
* Scan through the buffer looking for an IAC byte.
*/
while ((len = tvb_length_remaining(tvb, offset)) != 0) {
while ((len = tvb_length_remaining(tvb, offset)) > 0) {
iac_offset = tvb_find_guint8(tvb, offset, len, TN_IAC);
if (iac_offset != -1) {
/*

View File

@ -5,7 +5,7 @@
* Craig Newell <CraigN@cheque.uq.edu.au>
* RFC2347 TFTP Option Extension
*
* $Id: packet-tftp.c,v 1.16 2000/11/10 09:22:46 guy Exp $
* $Id: packet-tftp.c,v 1.17 2000/11/13 08:58:17 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@ -212,7 +212,7 @@ tftp_dissect_options(tvbuff_t *tvb, int offset, proto_tree *tree)
{
int i1, i2;
while (tvb_length_remaining(tvb, offset)) {
while (tvb_offset_exists(tvb, offset)) {
i1 = tvb_strnlen(tvb, offset, -1); /* length of option */
i2 = tvb_strnlen(tvb, offset+i1+1, -1); /* length of value */
proto_tree_add_text(tree, tvb, offset, i1+i2+2,