Skip to content

Fix for issue #488: ensure that the number of iovec entries does not exceed __IOV_MAX.#489

Merged
bradh352 merged 2 commits into
c-ares:mainfrom
dreibh:dreibh/write_tcp_data-check-for-IOV-MAX
Oct 23, 2022
Merged

Fix for issue #488: ensure that the number of iovec entries does not exceed __IOV_MAX.#489
bradh352 merged 2 commits into
c-ares:mainfrom
dreibh:dreibh/write_tcp_data-check-for-IOV-MAX

Conversation

@dreibh

@dreibh dreibh commented Oct 18, 2022

Copy link
Copy Markdown
Contributor

Fix for issue #488: ensure that the number of iovec entries does not exceed __IOV_MAX.

@gvanem

gvanem commented Oct 19, 2022

Copy link
Copy Markdown
Contributor

This is Linux specific. On Windows, I get:

src/lib/ares_process.c(259,23): error: use of undeclared identifier '__IOV_MAX'
              if(n >= __IOV_MAX)
                      ^

@dreibh

dreibh commented Oct 19, 2022

Copy link
Copy Markdown
Contributor Author

Indeed, this was not platform-independent. It also failed on FreeBSD. I have no Windows system for testing.

I updated the code, according to the documentation in the writev() manpage. IOV_MAX is used on FreeBSD, on modern Linux the limit is from sysconf(_SC_IOV_MAX), on very old Linux it is 16. The default of 16 is also used by the BOOST libraries, in case of IOV_MAX and sysconf(_SC_IOV_MAX) not being possible.

@bradh352 bradh352 merged commit 3400e07 into c-ares:main Oct 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants