Ensure buffer for gethostname(2) is properly terminated

This commit is contained in:
Benny Baumann 2021-03-04 23:42:24 +01:00
parent c5770c26af
commit 23c5b9ce3c
1 changed files with 1 additions and 0 deletions

View File

@ -13,4 +13,5 @@ in the source distribution for its full text.
void Generic_hostname(char* buffer, size_t size) { void Generic_hostname(char* buffer, size_t size) {
gethostname(buffer, size - 1); gethostname(buffer, size - 1);
buffer[size - 1] = '\0';
} }