10
10
* Copyright (c) 2016 Intel, Inc. All rights reserved.
11
11
* Copyright (c) 2016 Research Organization for Information Science
12
12
* and Technology (RIST). All rights reserved.
13
+ * Copyright (c) 2023 NVIDIA Corporation. All rights reserved.
14
+ * Copyright (c) 2023 Jeffrey M. Squyres. All rights reserved.
13
15
* $COPYRIGHT$
14
16
*
15
17
* Additional copyrights may follow
@@ -682,8 +684,18 @@ static int rebuild_communicator_list (mqs_process *proc)
682
684
p_info );
683
685
old -> group = find_or_create_group ( proc , group_base );
684
686
}
685
- mqs_fetch_data ( proc , comm_ptr + i_info -> ompi_communicator_t .offset .c_name ,
686
- 64 , old -> comm_info .name );
687
+ mqs_taddr_t name_addr = ompi_fetch_pointer ( proc ,
688
+ comm_ptr + i_info -> ompi_communicator_t .offset .c_name ,
689
+ p_info );
690
+ /* c_name can be up to MPI_MAX_OBJECT_NAME bytes, but we only
691
+ * copy the first (sizeof(old->comm_info.name)-1) here. Make
692
+ * sure the string is correctly terminated. */
693
+ size_t target_size = sizeof (old -> comm_info .name );
694
+ mqs_fetch_data ( proc , name_addr , target_size , old -> comm_info .name );
695
+ old -> comm_info .name [target_size - 1 ] = '\0' ;
696
+ /* Defensively zero anything beyond the actual name */
697
+ size_t src_strlen = strlen (old -> comm_info .name );
698
+ memset (old -> comm_info .name + src_strlen , 0 , target_size - 1 - src_strlen );
687
699
688
700
if ( NULL != old -> group ) {
689
701
old -> comm_info .size = old -> group -> entries ;
@@ -1156,8 +1168,9 @@ static int fetch_request( mqs_process *proc, mpi_process_info *p_info,
1156
1168
ompi_datatype + i_info -> ompi_datatype_t .offset .size ,
1157
1169
p_info );
1158
1170
/* Be user friendly, show the datatype name */
1171
+ size_t data_name_size = sizeof (data_name );
1159
1172
mqs_fetch_data ( proc , ompi_datatype + i_info -> ompi_datatype_t .offset .name ,
1160
- 64 , data_name );
1173
+ data_name_size , data_name );
1161
1174
if ( '\0' != data_name [0 ] ) {
1162
1175
// res->extra_text[x] is only 64 chars long -- same as
1163
1176
// data_name. If you try to snprintf it into
@@ -1171,6 +1184,11 @@ static int fetch_request( mqs_process *proc, mpi_process_info *p_info,
1171
1184
(int )res -> desired_length );
1172
1185
snprintf ( (char * )res -> extra_text [2 ], 64 , "%s" ,
1173
1186
data_name );
1187
+ } else {
1188
+ data_name [data_name_size - 1 ] = '\0' ;
1189
+ /* Be nice and zero anything beyond the actual name */
1190
+ size_t data_name_strlen = strlen (data_name );
1191
+ memset (data_name + data_name_strlen , 0 , data_name_size - 1 - data_name_strlen );
1174
1192
}
1175
1193
/* And now compute the real length as specified by the user */
1176
1194
res -> desired_length *=
0 commit comments