Use a non-volatile temporary variable as a parameter to DISSECTOR_ASSERT().

This avoids an "assert with side effects" warning and resolves Coverity CID322.

svn path=/trunk/; revision=37441
This commit is contained in:
Chris Maynard 2011-05-27 18:08:46 +00:00
parent e3dff872d0
commit 0a3319cbc6
1 changed files with 8 additions and 2 deletions

View File

@ -4757,12 +4757,18 @@ dissect_x11_replies(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
break;
case 1:
{
/* To avoid an "assert w/side-effect" warning,
* use a non-volatile temp variable instead. */
int tmp_plen;
/* replylength is in units of four. */
plen = 32 + VALUE32(tvb, offset + 4) * 4;
DISSECTOR_ASSERT(plen >= 32);
tmp_plen = plen = 32 + VALUE32(tvb, offset + 4) * 4;
DISSECTOR_ASSERT(tmp_plen >= 32);
HANDLE_REPLY(plen, length_remaining,
"Reply", dissect_x11_reply);
break;
}
default:
/* Event */