Skip to content

Commit

Permalink
Merge c4008fb into 1195177
Browse files Browse the repository at this point in the history
  • Loading branch information
ZoltanFridrich committed Mar 21, 2024
2 parents 1195177 + c4008fb commit 1758f48
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions p11-kit/rpc-server.c
Expand Up @@ -286,10 +286,12 @@ proto_read_attribute_buffer_array (p11_rpc_message *msg,
rv = proto_read_attribute_buffer_array (msg, &array, &n_array);
if (rv != CKR_OK)
return rv;
if (ULONG_MAX / n_array < sizeof (CK_ATTRIBUTE) ||

if ((n_array != 0 && ULONG_MAX / n_array < sizeof (CK_ATTRIBUTE)) ||
length < n_array * sizeof (CK_ATTRIBUTE))
return PARSE_ERROR;
attrs[i].pValue = array;

attrs[i].pValue = (n_array == 0) ? NULL : array;
attrs[i].ulValueLen = n_array * sizeof (CK_ATTRIBUTE);
} else {
attrs[i].pValue = p11_rpc_message_alloc_extra (msg, length);
Expand Down

0 comments on commit 1758f48

Please sign in to comment.