[gnutls-devel] GnuTLS | Fix coverity in lib/ (!1092)

Development of GNU's TLS library gnutls-devel at lists.gnutls.org
Tue Oct 15 12:07:32 CEST 2019

Nikos Mavrogiannopoulos commented on a discussion on lib/str.c: https://gitlab.com/gnutls/gnutls/merge_requests/1092#note_230554687

>  	gnutls_datum_t tdata;
>  	_gnutls_buffer_pop_datum(str, &tdata, req_size);
> -	if (tdata.data == NULL || tdata.size != req_size) {
> +	if (tdata.data == NULL || tdata.size > req_size) {

btw. what this function does, if you ask 2 bytes, it will always give you two bytes. If the struct has 4 bytes, that's fine, it will still give you two bytes (because of the pop_datum call). It will fail when the structure did not have enough data stored (e.g., asked for 2 while it has only 1). You can see how it is used in practice in `hello_retry.c`

Reply to this email directly or view it on GitLab: https://gitlab.com/gnutls/gnutls/merge_requests/1092#note_230554687
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/20191015/f7bba146/attachment-0001.html>

More information about the Gnutls-devel mailing list