[gnutls-devel] GnuTLS | Refactor pkcs11_find_objects to use p11-kit iterator (!1758)
Read-only notification of GnuTLS library development activities
gnutls-devel at lists.gnutls.org
Thu Aug 3 11:37:57 CEST 2023
Daiki Ueno started a new discussion on lib/pkcs11.c: https://gitlab.com/gnutls/gnutls/-/merge_requests/1758#note_1498518906
> -
> - for (j = 0; j < count; j++) {
> - a[0].type = CKA_ID;
> - a[0].value = certid_tmp;
> - a[0].value_len = sizeof certid_tmp;
> -
> - if (pkcs11_get_attribute_value(sinfo->module,
> - sinfo->pks, ctx[j], a,
> - 1) == CKR_OK) {
> - id.data = a[0].value;
> - id.size = a[0].value_len;
> - } else {
> - id.data = NULL;
> - id.size = 0;
> + if (find_data->current + 1 > alloc_size) {
> + alloc_size = alloc_size == 0 ? 2 : alloc_size * 2;
Sorry, I should have spotted this earlier, but we probably want to check overflow here. Something like:
```c
alloc_size = xtimes(xsum(alloc_size, 1), 2);
if (size_overflow_p(alloc_size)) {
ret = gnutls_assert_val(GNUTLS_E_MEMORY_ERROR);
goto fail;
}
find_data->p_list = _gnutls_reallocarray_fast(..., alloc_size, ...);
```
--
Reply to this email directly or view it on GitLab: https://gitlab.com/gnutls/gnutls/-/merge_requests/1758#note_1498518906
You're receiving this email because of your account on gitlab.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.gnupg.org/pipermail/gnutls-devel/attachments/20230803/34a9ed48/attachment-0001.html>
More information about the Gnutls-devel
mailing list