[gnutls-devel] GnuTLS | build: avoid potential integer overflow in array allocation (!1392)

Read-only notification of GnuTLS library development activities gnutls-devel at lists.gnutls.org
Sun Feb 28 17:55:57 CET 2021




Daiki Ueno commented on a discussion on lib/cert-cred.c: https://gitlab.com/gnutls/gnutls/-/merge_requests/1392#note_518822155

>  				       int nr)
>  {
> -	res->sorted_cert_idx = gnutls_realloc_fast(res->sorted_cert_idx,
> -						(1 + res->ncerts) *
> -						sizeof(unsigned int));
> +	res->sorted_cert_idx = _gnutls_reallocarray_fast(res->sorted_cert_idx,
> +							 1 + res->ncerts,
> +							 sizeof(unsigned int));
>  	if (res->sorted_cert_idx == NULL)
>  		return gnutls_assert_val(GNUTLS_E_MEMORY_ERROR);
>  
> -	res->certs = gnutls_realloc_fast(res->certs,
> -					 (1 + res->ncerts) *
> -					 sizeof(certs_st));
> +	res->certs = _gnutls_reallocarray_fast(res->certs,
> +					       1 + res->ncerts,

The follow-up change actually makes it consistent with the latter style.

-- 
Reply to this email directly or view it on GitLab: https://gitlab.com/gnutls/gnutls/-/merge_requests/1392#note_518822155
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/20210228/10247d7a/attachment-0001.html>


More information about the Gnutls-devel mailing list