git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: What's cooking in git.git (Apr 2017, #02; Sun, 16)

From
Jonathan Nieder <jrnieder@gmail.com>
Date
Apr 17, 2017, 17:37 UTC
Message-ID
<20170417173722.GA8486@aiede.mtv.corp.google.com>
In-Reply-To
<e6f869b1-09c2-88eb-d79d-b0dc2090a632@web.de>
René Scharfe wrote:
> Am 17.04.2017 um 09:30 schrieb Junio C Hamano:
Show 34 quoted lines
>> * 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>
> ---
>  builtin/gc.c           | 2 +-
>  builtin/receive-pack.c | 2 +-
>  daemon.c               | 4 ----
>  fetch-pack.c           | 2 +-
>  git-compat-util.h      | 4 ++++
>  ident.c                | 2 +-
>  6 files changed, 8 insertions(+), 8 deletions(-)
Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
Thank you.
Previous: René ScharfeNext: Junio C Hamano
Message 3 of 4 in “What's cooking in git.git (Apr 2017, #02; Sun, 16)”
  1. Junio C HamanoApr 17, 2017
  2. René ScharfeApr 17, 2017
  3. Jonathan NiederApr 17, 2017
  4. Junio C HamanoApr 18, 2017

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.