[gnutls-devel] GnuTLS | sockets: fixed building for Windows with compilers without VLA support (alternative version) (!1490)

Read-only notification of GnuTLS library development activities gnutls-devel at lists.gnutls.org
Fri Nov 26 15:36:25 CET 2021




Daiki Ueno started a new discussion on lib/system/sockets.c: https://gitlab.com/gnutls/gnutls/-/merge_requests/1490#note_745060082

>  system_writev(gnutls_transport_ptr_t ptr, const giovec_t * iovec,
>  	      int iovec_cnt)
>  {
> -	WSABUF bufs[iovec_cnt];
> +	WSABUF bufs[32];
>  	DWORD bytes_sent;
>  	int to_send_cnt = 0;
>  	size_t to_send_bytes = 0;
>  
> -	while (to_send_cnt < iovec_cnt && to_send_bytes < SSIZE_MAX) {
> +	while (to_send_cnt < iovec_cnt &&
> +			(size_t) to_send_cnt < sizeof(bufs) / sizeof(bufs[0]) &&

nit:
```suggestion:-1+0
	while (to_send_cnt < MIN((size_t) iovec_cnt, sizeof(bufs) / sizeof(bufs[0])) &&
```
after defining `to_send_cnt` as `size_t`?

-- 
Reply to this email directly or view it on GitLab: https://gitlab.com/gnutls/gnutls/-/merge_requests/1490#note_745060082
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/20211126/c27b4831/attachment.html>


More information about the Gnutls-devel mailing list