Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expand Hostname Buffer #17

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Expand Hostname Buffer #17

wants to merge 1 commit into from

Conversation

edwbuck
Copy link

@edwbuck edwbuck commented Apr 22, 2016

The buffer holding the results for gethostname now contains
HOST_NAME_MAX + 1 characters so it may contain hostnames at
HOST_NAME_MAX printable characters and a terminating null.

Prior to this change, the buffer could only accomodate hostnames
of HOST_NAME_MAX - 1 characters.

If you had a hostname that was HOST_NAME_MAX (64 characters on Linux)
with the old buffer, the call to gethostname(...) would succeed but truncate
the hostname (the truncation behavior is not fully specified, according to
the GETHOSTNAME(2) man page). On my platform, this led to a zero length
hostname which caused subsequent failures.

The buffer holding the results for gethostname now contains
HOST_NAME_MAX + 1 characters so it may contain hostnames at
HOST_NAME_MAX printable characters and a terminating null.

Prior to this change, the buffer could only accomodate hostnames
of HOST_NAME_MAX - 1 characters.
dasJ added a commit to helsinki-systems/libspf2 that referenced this pull request Aug 11, 2021
This merges shevek#17

* pull/17:
  Expand Hostname Buffer
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.

1 participant