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 issues found by the last Coverity Scan check #33

Merged
merged 4 commits into from
Jul 26, 2022

Conversation

oerdnj
Copy link
Contributor

@oerdnj oerdnj commented Jul 26, 2022

No description provided.

Instead of returning from p11prov_store_load() under lock if
p11prov_ctx_fns() returns NULL, break from the loop to handle the error
path normally.

Signed-off-by: Ondřej Surý <[email protected]>
The find_keys() function could initialize the *pub and *priv key
parameters while returning an error.  Fix the internal logic to only set
the *pub and *priv pointers on a success.  While it's normally ok to
expect the extra parameters to be in undefined state, at least in
p11prov_store_load(), it might happen that *pub and *priv would be used
later even if find_keys() returned error.

Signed-off-by: Ondřej Surý <[email protected]>
@oerdnj
Copy link
Contributor Author

oerdnj commented Jul 26, 2022

Modify the key pointers in find_keys() only on success

This could be also fixed by clearing the public and private key pointers on error in the p11prov_store_load(), but I think it's cleaner to only touch the dereferenced pointers only on success.

The p11prov_debug_token_info() had CK_INFO_TOKEN structure parameter
instead of the pointer to it, while relatively harmless, there was no
reason why pointer to CK_INFO_TOKEN couldn't be passed.

Signed-off-by: Ondřej Surý <[email protected]>
@simo5 simo5 merged commit ccb8447 into latchset:main Jul 26, 2022
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