From 23c5b9ce3c50a7c7aaa9a5734cad50d12610d8d8 Mon Sep 17 00:00:00 2001 From: Benny Baumann Date: Thu, 4 Mar 2021 23:42:24 +0100 Subject: [PATCH] Ensure buffer for gethostname(2) is properly terminated --- generic/hostname.c | 1 + 1 file changed, 1 insertion(+) diff --git a/generic/hostname.c b/generic/hostname.c index 78404e43..2e3d5c31 100644 --- a/generic/hostname.c +++ b/generic/hostname.c @@ -13,4 +13,5 @@ in the source distribution for its full text. void Generic_hostname(char* buffer, size_t size) { gethostname(buffer, size - 1); + buffer[size - 1] = '\0'; }