Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix handling of malicious PDV size #87

Closed

Conversation

doskachok
Copy link

It was possible to overflow the length variable in DT_2_IndicatePData on line "length -= 4 + pdvLength;" when pdvLength is set by a server to a value greater then LONG_MAX + pduLength. By doing that the length overflowed and became positive, even if it was initially less than 4 + pdvLength. Due to the overflow "if (pdvLength < 2)" was not working and in the next loop iteration EXTRACT_LONG_BIG was causing read access violation.

Added check "length < 4 + pdvLength" to solve this problem.
Added check ULONG_MAX - pdvLength < 4 to make sure pdvLength + 4 will not overflow unsigned long.

It was possible to overflow length in "length -= 4 + pdvLength;" when pdvLength is set to a value greater then LONG_MAX + pduLength. By doing that the length overflowed and became positive, even if it was initially less than 4 + pdvLength.
By doing this we avoid warning '<': signed/unsigned mismatch. This can also prevent problems when pduLength is greater than long.
@michaelonken
Copy link
Member

Hi, since we are in the process of preparing a release right now, we don't want to integrate any serious changes in the networking code. We will integrate the patch after the release, i.e. probably in 2-3 weeks.

@michaelonken
Copy link
Member

Since this is security-related, we decided to integrate this into the upcoming release. See commit 1549d8c. Thanks for your report and patch!

@doskachok
Copy link
Author

@michaelonken, that's great news, thank you! Could you please also have a look at #79 when you have time after release?

@michaelonken
Copy link
Member

Sure, w already have an internal feature branch that expanded on the work of #79. No pull request gets lost ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants