diff options
author | Guy Harris <guy@alum.mit.edu> | 2003-09-09 09:20:07 +0000 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2003-09-09 09:20:07 +0000 |
commit | 5f7d204bd359055ef2f96c1cd2827164c8ecc40b (patch) | |
tree | d04f448a6b321ab93499195c00a6b94494360a6d /packet-gprs-ns.c | |
parent | 8b5b480bf659ca442801cc8ab44af0ebd69b119c (diff) |
If the uppermost bit of the first length octet is set, it means that the
length is in the lower 7 bits of that octet, not that there's another
octet of length.
svn path=/trunk/; revision=8431
Diffstat (limited to 'packet-gprs-ns.c')
-rw-r--r-- | packet-gprs-ns.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/packet-gprs-ns.c b/packet-gprs-ns.c index a001feeb2d..4264bb93b6 100644 --- a/packet-gprs-ns.c +++ b/packet-gprs-ns.c @@ -3,7 +3,7 @@ * dissection * Copyright 2003, Josef Korelus <jkor@quick.cz> * - * $Id: packet-gprs-ns.c,v 1.4 2003/09/09 08:53:48 guy Exp $ + * $Id: packet-gprs-ns.c,v 1.5 2003/09/09 09:20:07 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -120,8 +120,16 @@ process_tlvs(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) length_len = 1; length = tvb_get_guint8(tvb, offset); if (length & 0x80) { + /* + * This is the final octet of the length. + */ + length &= 0x7F; + } else { + /* + * One more octet. + */ length_len++; - length = ((length & 0x7F) << 8) | tvb_get_guint8(tvb, offset); + length = (length << 8) | tvb_get_guint8(tvb, offset); } proto_tree_add_uint(tree, hf_gprs_ns_ie_length, tvb, offset, length_len, length); |