[gnutls-devel] GnuTLS | Fix gnutls_pkcs11_token_get_info for short output buffers and fix a memleak (!827)

Development of GNU's TLS library gnutls-devel at lists.gnutls.org
Thu Dec 13 15:01:23 CET 2018

Peter Wu commented on a discussion on lib/pkcs11.c:

>  			goto cleanup;
>  		}
> -		snprintf(output, *output_size, "%s", tn.modname);
> -		*output_size = strlen(output);
> -		ret = 0;
> -		goto cleanup;
> +		modname = tn.modname;
> +		if (modname == NULL) {
> +			gnutls_assert();

Are you concerned about applications passing an uninitialized buffer and then trying to read uninitialized memory or the fact that the return value changed?

Previously `(null)` would be printed (or the application crashes depending on the C library), so I would argue that returning an error is also an appropriate action.

Reply to this email directly or view it on GitLab: https://gitlab.com/gnutls/gnutls/merge_requests/827#note_124714976
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/20181213/e604eda8/attachment.html>

More information about the Gnutls-devel mailing list