Fix Heap-based buffer overflow & integer overflow - #240
Merged
Conversation
The realloc threshold was lower than the possible output of mbus_data_variable_record_xml(), which could result in a buffer overflow. Thanks to Brian Willows (brian@graith.co.uk) and Adam Bedard (Security Researcher) for reporting. While at this reduce the result buffer of mbus_data_variable_header_xml() and mbus_data_variable_header_xml().
There was no limit for the XML output buffer, which could result in a integer overflow of 'buff_size'.
Since the return value of snprintf is counterintuitive, make sure the result is stored within an integer and check for all error cases before using it as buffer index.
Since the return value of snprintf is counterintuitive, make sure the result is stored within an integer and check for all error cases before using it as buffer index.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request fix some heap-based buffer overflows and integer overflow in the output buffer allocation. Finally all bad usage of snprintf is fixed.
Thanks to Brian Willows (brian@graith.co.uk) and Adam Bedard (Security
Researcher) for reporting