2
을 채울 때 나는 그것이 캡처에 대해 실행할 때 다음과 같은 버그 경고를 throw 간단한 와이어 샤크의 해부학자 있습니다와이어 샤크 C 해부학자 오류 하위 트리
이13:04:12 Warn Dissector bug, protocol usbserial, in packet 353: /wireshark/epan/proto.c:5504:
failed assertion "idx >= 0 && idx < num_tree_types"
프로토콜 등록 기능은 다음과 같습니다
static gint ett_myproto = -1;
void
proto_register_myproto(void)
{
/* Set up field array */
static hf_register_info hf[] = {
{ &hf_myproto_payload,
{"Payload", "myproto.payload", FT_BYTES, BASE_NONE, NULL,
0x0, NULL, HFILL }},
};
/* Register protocol */
proto_myproto = proto_register_protocol("My Protocol", "myproto", "myproto");
/* Register protocol fields */
proto_register_field_array(proto_myproto, hf, array_length(hf));
/* Register the dissector */
register_dissector("myproto", dissect_myproto, proto_myproto);
}
을
해부학자는 데이터의 몇 가지 일반적인 munging을 수행하지만, 문제 영역의 핵심이 될 것으로 보인다 :
static int
dissect_myproto(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
void *data _U_)
{
proto_item *ti;
proto_tree *myproto_tree;
/* Create top tree and add to the item */
ti = proto_tree_add_protocol_format(tree, proto_myproto, tvb, 0, -1,
"My Protocol");
myproto_tree = proto_item_add_subtree(ti, ett_myproto);
proto_tree_add_bytes_format(myproto_tree, hf_myproto_payload,
tvb, 0, payload_len,
NULL, "Payload");
}
프로토콜이 하위 트리를 올바르게 채우려면 어떻게해야합니까?
일반적으로 이러한 문제는 [doc/packet-PROTOABBREV.c] (https://github.com/wireshark/wireshark/boc/master/doc/packet-PROTOABBREV.c)의 샘플 해독기 코드와 비교할 때 쉽게 감지됩니다.) – Lekensteyn