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

Resizing/Truncating returned lists #34

Closed
daxpedda opened this issue Jul 19, 2021 · 1 comment
Closed

Resizing/Truncating returned lists #34

daxpedda opened this issue Jul 19, 2021 · 1 comment
Labels
bug Something isn't working good first issue Good for newcomers medium Effort label

Comments

@daxpedda
Copy link
Contributor

Pkcs11::get_slots_with_token, Pkcs11::get_all_slots and Pkcs11::get_mechanism_list currently truncate returned lists to account for changed sizes between querying the size and getting the list, a typical race condition.

There are two problems with this currently:

  • Vec::resize is used instead of Vec::truncate for Pkcs11::get_slots_with_token and Pkcs11::get_all_slots
  • Lists can also increase in size, which returns an error, it might be better to put it in a loop until the correct size is established
@hug-dev hug-dev added bug Something isn't working good first issue Good for newcomers medium Effort label labels Jul 19, 2021
vkkoskie added a commit to vkkoskie/rust-cryptoki that referenced this issue Nov 11, 2021
Fixes parallaxsecond#34 with respect to slots (still open for mechanisms)

Signed-off-by: Keith Koskie <[email protected]>
vkkoskie added a commit to vkkoskie/rust-cryptoki that referenced this issue Nov 11, 2021
Fixes parallaxsecond#34 with respect to slots (still open for mechanisms)

Signed-off-by: Keith Koskie <[email protected]>
vkkoskie added a commit to vkkoskie/rust-cryptoki that referenced this issue Nov 22, 2021
Fixes parallaxsecond#34 with respect to slots (still open for mechanisms)

Signed-off-by: Keith Koskie <[email protected]>
@ionut-arm
Copy link
Member

Reopening this as the original PR was merged by mistake and then nuked from main.

@ionut-arm ionut-arm reopened this Dec 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers medium Effort label
Projects
None yet
Development

No branches or pull requests

3 participants