]> git.ipfire.org Git - thirdparty/git.git/commit - fetch-pack.c
use HOST_NAME_MAX to size buffers for gethostname(2)
authorRené Scharfe <l.s.r@web.de>
Tue, 18 Apr 2017 21:57:42 +0000 (17:57 -0400)
committerJunio C Hamano <gitster@pobox.com>
Wed, 19 Apr 2017 02:57:41 +0000 (19:57 -0700)
commitda25bdb7766c01665500cf7c7b75e76ea1f28b49
tree0130260984ed75f313cacb0fb1c452ce6f47dcf1
parentc3808ca6982b0ad7ee9b87eca9b50b9a24ec08b0
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@twosigma.com>
Signed-off-by: Rene Scharfe <l.s.r@web.de>
Signed-off-by: David Turner <dturner@twosigma.com>
Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/gc.c
builtin/receive-pack.c
daemon.c
fetch-pack.c
git-compat-util.h
ident.c