-
Notifications
You must be signed in to change notification settings - Fork 94
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
CK_DATE - memory allocation error #244
Comments
It shall be set by the caller of any PKCS#11 function that takes a CK_DATE attribute (typically a part of attribute array, e.g., |
Using pkcs-dump dump command. |
Do you mean this? |
Yes, correct for this pkcs-dump repo. It is a good stress test. I use p11-kit remote (over ssh). |
Which PKCS#11 module do you actually remote (e.g., opensc-pkcs11.so, something proprietary)? |
I use a proprietary one ; I do not have an opensc compatible card to try with. From the code I do not understand why a wrong value can lead to such memory issue. Moreover, according to oasis pkcs11 specification, I remember that a request with a value 0 means "get/return the size of the memory", doesn't it ? |
For details, see some traces I added from the pkcs11-dump/Dump() function: then, we get these traces:
I'll keep investigating. |
FYI, when we do a direct access with
More debugs from pkcs-dump (without p11-remote) shows that: ulValueLen is 0:
the output is: |
Fix the issue p11-glue#244 : one should return an empty buffer whenever its length is 0.
Maybe this fix could be generalized for any cases when the length is 0. What do you think ? |
Thank you for the investigation. Yes, indeed the PKCS#11 spec suggests that ulValueLen should be 0 for the attributes that are specified to be empty, and CKA_START_DATE and CKA_END_DATE are two of them. |
Then, should we turn my patch into a generic one for all the cases when ulValueLen is 0 ? |
Fix the issue p11-glue#244 : one should return an empty buffer whenever its length is 0.
Unlike other data types, CK_DATE value may be empty (and that is the default). Treat it as a valid value and serialize/deserialize accordingly. Reported by Vincent JARDIN in: p11-glue#244
This issue is fixed by the pull request #253 , it can be closed once it'll be pushed. |
Unlike other data types, CK_DATE value may be empty (and that is the default). Treat it as a valid value and serialize/deserialize accordingly. Reported by Vincent JARDIN in: #244
Hi,
When I have a CK_DATE, then we get this memory failure that is recorded here https://github.com/p11-glue/p11-kit/blob/master/p11-kit/rpc-message.c#L988
For this issue, value_length is 0 byte which of course is not a validé one. How/when should value_length be set ?
Thank you,
The text was updated successfully, but these errors were encountered: