Skip to content

Commit 922fcca

Browse files
authored
Merge pull request #6220 from jsquyres/pr/fix-type-set-name
MPI_Type_set_name: fix string length at target
2 parents 908655a + efcaef7 commit 922fcca

File tree

1 file changed

+1
-7
lines changed

1 file changed

+1
-7
lines changed

ompi/mpi/c/type_set_name.c

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,6 @@ static const char FUNC_NAME[] = "MPI_Type_set_name";
4747

4848
int MPI_Type_set_name (MPI_Datatype type, const char *type_name)
4949
{
50-
int length;
51-
5250
MEMCHECKER(
5351
memchecker_datatype(type);
5452
);
@@ -65,10 +63,6 @@ int MPI_Type_set_name (MPI_Datatype type, const char *type_name)
6563
}
6664

6765
memset(type->name, 0, MPI_MAX_OBJECT_NAME);
68-
length = (int)strlen( type_name );
69-
if( length >= MPI_MAX_OBJECT_NAME ) {
70-
length = MPI_MAX_OBJECT_NAME - 1;
71-
}
72-
opal_string_copy( type->name, type_name, length );
66+
opal_string_copy( type->name, type_name, MPI_MAX_OBJECT_NAME);
7367
return MPI_SUCCESS;
7468
}

0 commit comments

Comments
 (0)