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

Development of GNU's TLS library gnutls-devel at lists.gnutls.org
Fri Oct 11 20:20:09 CEST 2019




Tim Rühsen commented on a discussion on lib/record.c: https://gitlab.com/gnutls/gnutls/merge_requests/1092#note_229506717

>  		     (int) _mbuffer_get_udata_size(decrypted));
>  
>  		/* store the last valid sequence number. We don't use that internally but
> -		 * callers of gnutls_record_get_state() could take advantage of it. */
> -		memcpy(&record_state->sequence_number, packet_sequence, 8);
> +		 * callers of gnutls_record_get_state() could take advantage of it.
> +		 *
> +		 * Coverity issue 1454647 suggest to use memmove() here instead of memcpy().
> +		 */
> +		memmove(&record_state->sequence_number, packet_sequence, 8);

memmove and memcpy are using the same implementations when the code doesn't overlap. So there is just an extra check in memove. Some people even think it's safer to *always* use memmove instead of memcpy.

But i'll have an extra look *why* Coverity thinks that both regions *might* overlap.

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


More information about the Gnutls-devel mailing list