Skip to content

Fix 1 byte overlay in comm_method_string: Coverity CID 1515829 #10931

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 17, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions ompi/mca/hook/comm_method/hook_comm_method_fns.c
Original file line number Diff line number Diff line change
Expand Up @@ -126,12 +126,14 @@ comm_method_string(MPI_Comm comm, int rank, int *comm_mode) {
else {
/* Determine how much memory is needed to store UCX transport info */
char *s = UCX_TAG;
name_length = strlen(s);
/* Allocate storage to store UCX transport info, accounting for
* trailing '\0' in UCX_TAG and ',' and ';' delimiting each transport string
* then build the info string */
name_length = strlen(s) + 1;
for (i = 0; i < transports->count; i++) {
name_length = name_length + strlen(transports->entries[i].transport_name) +
strlen(transports->entries[i].device_name) + 2;
}
/* Allocate storage to store UCX transport info then build the info string */
string = malloc(name_length);
if (!string) {
return NULL;
Expand Down