Update to r27292: only use "valuelen-1" when the valuelen is
MPI_MAX_INFO_VAL (so that we don't go beyond the end of the string). But otherwise, abibe by what says in MPI-2.2 / MPI-3.0 in the description of MPI_INFO_GET (where "it" refers to the valuelen argument): If it is less than the actual size of the value, the value is truncated. In C, valuelen should be one less than the amount of allocated space to allow for the null terminator. cmr:v1.7 This commit was SVN r27522. The following SVN revision numbers were found above: r27292 --> open-mpi/ompi@fb4af5e29c
Этот коммит содержится в:
родитель
7c3a2c3c92
Коммит
a980ee5ca1
@ -314,7 +314,11 @@ int ompi_info_get (ompi_info_t *info, char *key, int valuelen,
|
||||
strcpy(value, search->ie_value);
|
||||
} else {
|
||||
opal_strncpy(value, search->ie_value, valuelen);
|
||||
value[valuelen-1] = 0;
|
||||
if (MPI_MAX_INFO_VAL == valuelen) {
|
||||
value[valuelen-1] = 0;
|
||||
} else {
|
||||
value[valuelen] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
OPAL_THREAD_UNLOCK(info->i_lock);
|
||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user