[gnutls-devel] GnuTLS | Sockets: implement sendmsg()-like function on Win32 (!1377)

Read-only notification of GnuTLS library development activities gnutls-devel at lists.gnutls.org
Mon Feb 15 20:12:17 CET 2021

Evgeny Grin commented:

@dueno Thanks. Let me know how to improve it.

There are several thing must be handled in this function:
1. The size of each element must be less than `ULONG_MAX` (actually max value for `DWORD`). If any element with larger size if found, is must be truncated to ULONG_MAX and no more element must be processed.
2. GnuTLS cannot process successful return value more than `SSIZE_MAX`, so amount of total sent size must be limited to `SSIZE_MAX`.

The code is so complicated because `ssize_t` is variable depending of x32/x64, but size of DWORD is fixed on Win32.
To handle both x32 and x64 in uniformed way, code needs to be a bit complicated.

We can shield the second `if` like:
``` C++
		else if (iovec[to_send_cnt].iov_len > ULONG_MAX) {
			bufs[to_send_cnt].buf = iovec[to_send_cnt].iov_base;
			bufs[to_send_cnt].len = ULONG_MAX;
			ovrflwn = true;
 but it will not make code more readable.

Reply to this email directly or view it on GitLab: https://gitlab.com/gnutls/gnutls/-/merge_requests/1377#note_509565944
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/20210215/5af8ad05/attachment.html>

More information about the Gnutls-devel mailing list