Skip to content
Snippets Groups Projects
Commit 95c3d844 authored by Fredrik Thulin's avatar Fredrik Thulin
Browse files

proto_read_byte_buffer: Allocate buffer even for 0 bytes.

Best for the proxy to be as transparent as possible. This fixes a test
case with C_GenerateRandom of 0 bytes, found in pkcs11-tool --test.
parent b636f7fa
No related branches found
No related tags found
No related merge requests found
......@@ -214,9 +214,11 @@ proto_read_byte_buffer(CallState * cs, CK_BYTE_PTR * buffer,
*n_buffer = length;
*buffer = NULL;
/* If set to zero, then they just want the length */
if (!length)
return CKR_OK;
/* We go ahead and allocate a buffer even if length is zero. The code used
* to just return CKR_OK without allocating a buffer, but that breaks a
* test case in pkcs11-tool for C_GenerateRandom of 0 bytes. Best to be as
* transparent as possible and let the p11 module decide how to handle it.
*/
*buffer = call_alloc(cs, length * sizeof(CK_BYTE));
if (!*buffer)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment