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

Set and get configuration #35

Merged
merged 6 commits into from Jul 22, 2021
Merged

Conversation

ikrivosheev
Copy link
Contributor

Add support for set and get configuration

Copy link
Owner

@Hugal31 Hugal31 left a comment

Choose a reason for hiding this comment

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

Thanks for your PR! I left a few comments.

tests/tests.rs Outdated Show resolved Hide resolved
let layout = Layout::new::<u32>();
alloc(layout) as *mut u32
};
let result = unsafe { yara_sys::yr_get_configuration(name.to_yara(), value as *mut c_void) };
Copy link
Owner

Choose a reason for hiding this comment

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

  1. It is necessary to allocate the u32, can't you just pass a pointer to a stack variable?
  2. You leak value here, you must de-allocate it if you allocated it yourself.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thank you, fix!

src/internals/configuration.rs Outdated Show resolved Hide resolved
src/internals/configuration.rs Outdated Show resolved Hide resolved
@ikrivosheev ikrivosheev requested a review from Hugal31 July 21, 2021 08:10
@Hugal31 Hugal31 merged commit 967b23a into Hugal31:master Jul 22, 2021
@ikrivosheev ikrivosheev deleted the configuration_v2 branch July 22, 2021 12:19
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.

None yet

2 participants