[gnutls-devel] GnuTLS | Fix out-of-bounds memcpy in gnutls_realloc_zero() (!1592)
Read-only notification of GnuTLS library development activities
gnutls-devel at lists.gnutls.org
Wed May 18 12:07:34 CEST 2022
Tobias Heider commented on a discussion on lib/nettle/init.c: https://gitlab.com/gnutls/gnutls/-/merge_requests/1592#note_950914524
> }
>
> - if (new_size == 0)
> - goto done;
> + if (old_size == new_size)
> + return data;
>
> - if (new_size <= old_size) {
> - size_t d = old_size - new_size;
> - /* Don't bother reallocating */
> - if (d < old_size / 2) {
> - explicit_bzero((char *)data + new_size, d);
> - return data;
> + if (new_size < old_size) {
> + explicit_bzero((char *)data + new_size, old_size - new_size);
> + p = realloc(data, new_size);
Here is the fix I originally proposed: https://gitlab.com/tobhe/gnutls/-/commit/97a4603dc56aa529558229e8754121af840babdd
How would you feel about using this version (+cleanup if desired)
--
Reply to this email directly or view it on GitLab: https://gitlab.com/gnutls/gnutls/-/merge_requests/1592#note_950914524
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/20220518/fb0043d6/attachment.html>
More information about the Gnutls-devel
mailing list