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 EOF read error for char arrays in a BEEF0004 shellbag #730

Merged
merged 7 commits into from
Jun 27, 2024

Conversation

Miauwkeru
Copy link
Contributor

No description provided.

@Miauwkeru Miauwkeru requested a review from Poeloe June 25, 2024 08:16
Copy link

codecov bot commented Jun 25, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 74.97%. Comparing base (4a69ca0) to head (fc9738b).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #730      +/-   ##
==========================================
+ Coverage   74.92%   74.97%   +0.04%     
==========================================
  Files         295      295              
  Lines       25070    25070              
==========================================
+ Hits        18784    18796      +12     
+ Misses       6286     6274      -12     
Flag Coverage Δ
unittests 74.97% <100.00%> (+0.04%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@Poeloe Poeloe left a comment

Choose a reason for hiding this comment

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

Could you add a test case?

@Miauwkeru Miauwkeru requested a review from Poeloe June 26, 2024 13:55
self.localized_name = c_bag.char[None](fh)

if version >= 7 and localized_name_offset > 0:
self.localized_name = c_bag.wchar[None](fh)
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you add another test case that also evaluates this line? 😄

from dissect.target.plugins.os.windows.regf.shellbags import parse_shell_item_list


def test_parse_shell_item_list_chars() -> None:
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
def test_parse_shell_item_list_chars() -> None:
def test_parse_shell_item_list_char() -> None:

assert extension.localized_name == b"@shell32.dll,-21786"


def test_parse_shell_item_list_wchar() -> None:
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggestion: Maybe use pytest.parameterize and use shellbag, modification_time, long_name and localized_name as parameters? Then use id to distinguish the test cases char and wchar

@Miauwkeru Miauwkeru requested a review from Poeloe June 27, 2024 11:41
Poeloe
Poeloe previously approved these changes Jun 27, 2024
Copy link
Contributor

@Poeloe Poeloe left a comment

Choose a reason for hiding this comment

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

LGTM!

@Miauwkeru Miauwkeru merged commit e6a457a into main Jun 27, 2024
17 of 18 checks passed
@Miauwkeru Miauwkeru deleted the fix-eof-error-shellbags branch June 27, 2024 14:14
otnxSl pushed a commit to otnxSl/dissect.target that referenced this pull request Jul 9, 2024
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