From: Junio C Hamano <gitster@pobox.com>
To: "René Scharfe" <l.s.r@web.de>
Cc: David Turner <dturner@twopensource.com>,
git@vger.kernel.org, Jeff King <peff@peff.net>,
Jonathan Nieder <jrnieder@gmail.com>
Subject: Re: What's cooking in git.git (Apr 2017, #02; Sun, 16)
Date: Mon, 17 Apr 2017 18:56:07 -0700 [thread overview]
Message-ID: <xmqqo9vuh420.fsf@gitster.mtv.corp.google.com> (raw)
In-Reply-To: <e6f869b1-09c2-88eb-d79d-b0dc2090a632@web.de> ("René Scharfe"'s message of "Mon, 17 Apr 2017 11:56:52 +0200")
René Scharfe <l.s.r@web.de> writes:
> Am 17.04.2017 um 09:30 schrieb Junio C Hamano:
>> * dt/xgethostname-nul-termination (2017-04-13) 1 commit
>> - xgethostname: handle long hostnames
>>
>> gethostname(2) may not NUL terminate the buffer if hostname does
>> not fit; unfortunately there is no easy way to see if our buffer
>> was too small, but at least this will make sure we will not end up
>> using garbage past the end of the buffer.
>>
>> Will merge to 'next'.
>
> [Sorry for repeating, but I didn't see a direct reply.]
>
> If a host name doesn't fit then the buffer is too small. Let's make it
> big enough, reducing the number of magic constants and avoiding silent
> truncation all at the same time. Patch for that:
>
> -- >8 --
> Subject: [PATCH] use HOST_NAME_MAX to size buffers for gethostname(2)
>
> POSIX limits the length of host names to HOST_NAME_MAX. Export the
> fallback definition from daemon.c and use this constant to make all
> buffers used with gethostname(2) big enough for any possible result
> and a terminating NUL.
>
> Inspired-by: David Turner <dturner@twopensource.com>
> Signed-off-by: Rene Scharfe <l.s.r@web.de>
> ---
Thanks. Let's have this one immediately before David's
xgethostname() patch on the same topic branch.
The fact that the length of my_host[] vs locking_host[] being
different still remains, though. I do not know if it matters.
prev parent reply other threads:[~2017-04-18 1:56 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-04-17 7:30 What's cooking in git.git (Apr 2017, #02; Sun, 16) Junio C Hamano
2017-04-17 9:56 ` René Scharfe
2017-04-17 17:37 ` Jonathan Nieder
2017-04-18 1:56 ` Junio C Hamano [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=xmqqo9vuh420.fsf@gitster.mtv.corp.google.com \
--to=gitster@pobox.com \
--cc=dturner@twopensource.com \
--cc=git@vger.kernel.org \
--cc=jrnieder@gmail.com \
--cc=l.s.r@web.de \
--cc=peff@peff.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.