Skip to content

Commit

Permalink
[host] fix string size check
Browse files Browse the repository at this point in the history
detected by gcc10

Signed-off-by: Fabio M. Di Nitto <fdinitto@redhat.com>
  • Loading branch information
fabbione committed Jan 21, 2020
1 parent d50049c commit 7efd506
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion libknet/host.c
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ int knet_host_set_name(knet_handle_t knet_h, knet_node_id_t host_id, const char
goto exit_unlock;
}

if (strlen(name) >= KNET_MAX_HOST_LEN) {
if (strlen(name) >= KNET_MAX_HOST_LEN - 1) {
err = -1;
savederrno = EINVAL;
log_err(knet_h, KNET_SUB_HOST, "Requested name for host %u is too long: %s",
Expand Down

0 comments on commit 7efd506

Please sign in to comment.