Repository navigation
Fix: TAINTED.INT_OVERFLOW - #560
Merged
Merged
Conversation
The time_string_to_seconds() function converts a string to seconds by multiplying the parsed value by a unit multiplier. Without checking the value before multiplication, the result may exceed the range of long and cause signed integer overflow. Reject negative values and check the upper bound before multiplying by the unit multiplier. Parenthesize the multipliers in the division expressions to ensure that the overflow checks use the correct values. Signed-off-by: Timofey Mishin t.mishin@fobos-nt.ru Signed-off by: Dina Tagantseva dinchik@altlinux.org
The block_address_time_parser() function uses strtoul() to parse the configured blocking time. This allows negative input, such as -1, to be converted to a large unsigned value. Use strtol() and reject negative values. Check the upper bound before multiplying by the time unit to prevent integer overflow. Keep the existing limit of 500 days to reject values outside the supported range. Signed-off-by: Timofey Mishin t.mishin@fobos-nt.ru Signed-off by: Dina Tagantseva dinchik@altlinux.org
This was referenced Oct 8, 2026
Contributor
|
Looks good. Thanks for the contribution. |
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.
Problem:
Potential integer overflow in the
block_address_time_parser()function.Potential integer overflow in the
time_string_to_seconds()function.Solution:
Added range checks before multiplying the parsed time values by the corresponding time units. Negative values are rejected, and the upper bound is checked to prevent integer overflow.