Skip to content

Commit

Permalink
Ensure buffer for gethostname(2) is properly terminated
Browse files Browse the repository at this point in the history
  • Loading branch information
BenBE committed Mar 4, 2021
1 parent c5770c2 commit 23c5b9c
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions generic/hostname.c
Original file line number Diff line number Diff line change
Expand Up @@ -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';
}

0 comments on commit 23c5b9c

Please sign in to comment.