Wireshark-bugs: [Wireshark-bugs] [Bug 8841] dissect_per_normally_small_nonnegative_whole_number
Comment # 4
on bug 8841
from hustpigeon
(In reply to comment #3)
> From what I can see in dissect_per_length_determinant() source code, length
> parameter is being assigned the value and not the length:
>
> *length = val;
> if(hf_index!=-1){
> pi = proto_tree_add_uint(tree, hf_index, tvb, (offset>>3)-1, 1, *length);
> if (display_internal_per_fields)
> proto_item_append_text(pi," %s", str);
> else
> PROTO_ITEM_SET_HIDDEN(pi);
> }
>
> Can you elaborate on the exact issue you are facing when using those
> functions? There is something that I seem to be missing.
//////////////////////////////////////////////////////////////////////////
int dissect_per_length_determinant(******)
{
.....
/* 10.9.3.6 */
(1) if((byte&0x80)==0)
{
*length=byte;
return offset;
}
/* 10.9.3.7 */
(2) if((byte&0xc0)==0x80)
{
*length=(byte&0x3f);
*length=((*length)<<8)+tvb_get_guint8(tvb, offset>>3);
offset+=8;
return offset;
}
PER_NOT_DECODED_YET("10.9.3.8.1");
return offset;
}
let's read again, this function really pass out length, not value.
look at(1), *length=byte, here length is a number < 127 (accoding 10.9.3.7).
it represent the length of content, and content's length < 127 using PER .
/* 10.9.3.7 */ say:
"If "n" is less than or equal to 127, then "n" shall be encoded as a
non-negative-binary-integer (using the
procedures of 10.3) into bits 7 (most significant) to 1 (least significant) of
a single octet and bit 8 shall be set to zero.
This shall be appended to the field-list as a bit-field (octet-aligned in the
ALIGNED variant) followed by the associated
field or list of fields, completing these procedures."
so we know "*length" is length of "n",
for example n=0x20
PER is
----------------------------
| length | content=0x20 |
----------------------------
length maybe 0000 0010,which represent content is 2 BYTE.
in situation (2):
-------------------------------------------------------------
| length | content=0x20 |
--------------------------------------------------------------
length is two BYTE, maybe 10 000000 10000010 means content'length is 10000010
I am sorry, i just read the code, i have no issue. I feel logic is wrong.
You are receiving this mail because:
- You are watching all bug changes.