diff options
author | John Thacker <johnthacker@gmail.com> | 2021-10-15 21:54:00 -0400 |
---|---|---|
committer | Wireshark GitLab Utility <gerald+gitlab-utility@wireshark.org> | 2021-10-16 07:23:03 +0000 |
commit | 71ccbe9f37480603d27aedff85b1eeee94c901ef (patch) | |
tree | c6947d16800ea2d8805cffc0c4b141829c11987d | |
parent | 9f890e1deae8f858f7203878d8f05a1c20f7f9ed (diff) |
bencode: remove pointless recursion
This statement is at the top of the function, calls itself recursively
without changing any state, reaches the max recursion level, and then
travels back up the stack adding expert infos and returning -1, and
then at the end always causes a variable to be set to a known value.
Remove all that, and just set the variable to the value it's going to
have anyway. This speeds things up a lot and prevents adding dozens
of expert infos to dictionaries without otherwise changing the
behavior, which does seem to work.
-rw-r--r-- | epan/dissectors/packet-bencode.c | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/epan/dissectors/packet-bencode.c b/epan/dissectors/packet-bencode.c index 8ffd5eae70..c3cae8b701 100644 --- a/epan/dissectors/packet-bencode.c +++ b/epan/dissectors/packet-bencode.c @@ -183,9 +183,7 @@ static int dissect_bencoding_rec(tvbuff_t *tvb, packet_info *pinfo, } op = tvb_get_guint8(tvb, offset); - oplen = dissect_bencoding_rec(tvb, pinfo, offset, length, NULL, level + 1, NULL, 0); - if (oplen < 0) - oplen = length; + oplen = length; switch (op) { case 'd': |