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.
This commit is contained in:
John Thacker 2021-10-15 21:54:00 -04:00 committed by Wireshark GitLab Utility
parent 9f890e1dea
commit 71ccbe9f37
1 changed files with 1 additions and 3 deletions

View File

@ -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':