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 issue with existing reg_dword entries #56160

Merged
merged 2 commits into from
Mar 11, 2020
Merged

Conversation

twangboy
Copy link
Contributor

What does this PR do?

When passing an invalid formatted reg_dword data in the state file, such as '000001', the registry code casts it to the proper type. In the case of '000001' it would be cast to an integer 1. This conversion was happening after the comparison to see if changes were to be made, thus comparing
'000001' to the existing integer 1.

This PR moves the casting of the state file data before the comparison so that it is comparing proper types.

Also fixes some issues with the comments being returned by the state file where it was returning incorrect duplicate strings. <key name> added to <key name>. Now it returns <key value> added to <key name>

Added tests for the integer comparison.

Fixed tests for the new comments

What issues does this PR fix or reference?

#55284

Tests written?

Yes

Commits signed with GPG?

Yes

@twangboy twangboy requested a review from a team as a code owner February 13, 2020 22:25
@ghost ghost requested a review from waynew February 13, 2020 22:25
@twangboy twangboy added v3000.1 vulnerable version Merge Ready labels Mar 6, 2020
tests/unit/utils/test_win_reg.py Outdated Show resolved Hide resolved
When passing an invalid reg_dword type in the state file, such as
'000001', the registry code casts it to the proper type. In the case of
'000001' it would be case to an integer `11. This conversion was happening
after the comparison to see if changes were to be made, thus comparing
'000001' to the existing integer `1`.

This PR moves the casting of the state file data before the comparison
so that it is comparing proper types.

Also fixes some issues with the comments being returned by the state
file where it was returning incorrect duplicate strings. `<key name> added
to <key name>`. Now it returns `<key value> name added to <key name>`

Added tests for the integer comparison.

Fixed tests for the new comments
Copy link
Contributor

@waynew waynew left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚀

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

Successfully merging this pull request may close these issues.

6 participants