From 3cd2777adc40977665328c1367775738da8b69ac Mon Sep 17 00:00:00 2001 From: Ronnie Sahlberg Date: Wed, 8 Mar 2006 11:09:02 +0000 Subject: [PATCH] fix minor bug coverity 74 length_remaining could become -1 and if so the next tvb access (tvb_memcpy()) would cause an exception. not really an ethereal since it would have no ill effects in reality. change !=0 to >0 to make it more clear what we actually test. svn path=/trunk/; revision=17528 --- epan/dissectors/packet-bgp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/epan/dissectors/packet-bgp.c b/epan/dissectors/packet-bgp.c index d32baa2fe1..29d0736f2f 100644 --- a/epan/dissectors/packet-bgp.c +++ b/epan/dissectors/packet-bgp.c @@ -2741,7 +2741,7 @@ dissect_bgp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) * Scan through the TCP payload looking for a BGP marker. */ while ((reported_length_remaining = tvb_reported_length_remaining(tvb, offset)) - != 0) { + > 0) { /* * "reported_length_remaining" is the number of bytes of TCP payload * remaining. If it's more than the length of a BGP marker, @@ -2789,7 +2789,7 @@ dissect_bgp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) * offset, in which case we can replace the loop below with * a call to "tcp_dissect_pdus()". */ - while (tvb_reported_length_remaining(tvb, offset) != 0) { + while (tvb_reported_length_remaining(tvb, offset) > 0) { /* * This will throw an exception if we don't have any data left. * That's what we want. (See "tcp_dissect_pdus()", which is