Merge pull request #6208 from jsquyres/pr/info-get-fix
info_get: ensure to copy all requested characters
Этот коммит содержится в:
Коммит
0746b2edb3
@ -106,7 +106,13 @@ static void opal_info_get_nolock (opal_info_t *info, const char *key, int valuel
|
||||
* Set the flag and value
|
||||
*/
|
||||
*flag = 1;
|
||||
opal_string_copy(value, search->ie_value, valuelen);
|
||||
// Note: we copy exactly (valuelen) characters, because that's
|
||||
// what the caller asked for. Don't use opal_string_copy()
|
||||
// here, because that will guarantee to \0-terminate what is
|
||||
// copied (i.e., potentially copy (valuelen-1) chars and then
|
||||
// an additional \0). Instead: copy over exactly (valuelen)
|
||||
// characters, and if that's not \0-terminated, then so be it.
|
||||
memcpy(value, search->ie_value, valuelen);
|
||||
}
|
||||
}
|
||||
|
||||
|
Загрузка…
Ссылка в новой задаче
Block a user