- We may know the *_name is < MPI_MAX_OBJECT_NAME; Prevent does not.
Fix Coverity issues CID1068 and CID1069 This commit was SVN r19167.
Этот коммит содержится в:
родитель
be02211b4f
Коммит
82580701fb
@ -71,7 +71,7 @@ int MPI_Comm_get_name(MPI_Comm comm, char *name, int *length)
|
||||
able to completely fit into MPI_MAX_OBJECT_NAME bytes (i.e.,
|
||||
name+\0). */
|
||||
if ( comm->c_flags & OMPI_COMM_NAMEISSET ) {
|
||||
strcpy(name, comm->c_name);
|
||||
strncpy(name, comm->c_name, MPI_MAX_OBJECT_NAME);
|
||||
*length = (int) strlen(comm->c_name);
|
||||
} else {
|
||||
name[0] = '\0';
|
||||
|
@ -67,6 +67,6 @@ int MPI_Type_get_name(MPI_Datatype type, char *type_name, int *resultlen)
|
||||
able to completely fit into MPI_MAX_OBJECT_NAME bytes (i.e.,
|
||||
name+\0). */
|
||||
*resultlen = (int)strlen(type->name);
|
||||
strcpy(type_name, type->name);
|
||||
strncpy(type_name, type->name, MPI_MAX_OBJECT_NAME);
|
||||
return MPI_SUCCESS;
|
||||
}
|
||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user