Skip to content

Commit

Permalink
Merge pull request #1160 from markbrown314/issue-1159
Browse files Browse the repository at this point in the history
Fixed Off-by-one error in gethostname()
  • Loading branch information
markbrown314 authored Dec 9, 2024
2 parents 45e6e7e + c75c0eb commit 94fc0d0
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/runtime_util.c
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ int shmem_runtime_util_put_hostname(void)
char hostname[MAX_HOSTNAME_LEN+1];
int ret;

ret = gethostname(hostname, MAX_HOSTNAME_LEN);
ret = gethostname(hostname, MAX_HOSTNAME_LEN+1);
if (ret != 0) {
RETURN_ERROR_MSG("gethostname failed (%d)", ret);
return ret;
Expand Down Expand Up @@ -123,7 +123,7 @@ int shmem_runtime_util_populate_node(int *location_array, int size, int *node_si
int ret, i, n_node_pes = 0;
char hostname[MAX_HOSTNAME_LEN+1];

ret = gethostname(hostname, MAX_HOSTNAME_LEN);
ret = gethostname(hostname, MAX_HOSTNAME_LEN+1);
if (ret != 0) {
RETURN_ERROR_MSG("gethostname failed (%d)", ret);
return ret;
Expand Down

0 comments on commit 94fc0d0

Please sign in to comment.