sec/base: fix coverity issues
CID 1292483 Uninitialized pointer read (UNINIT) Initialize the method and credential members of the opal_sec_cred_t to avoid possible invalid read when calling cleanup_cred. CID 1292484 Double free (USE_AFTER_FREE) Set method and credential members to NULL after freeing in cleanup_cred. Signed-off-by: Nathan Hjelm <hjelmn@lanl.gov>
Этот коммит содержится в:
родитель
f5389cbb03
Коммит
13e0a9da3a
@ -1,5 +1,8 @@
|
||||
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
|
||||
/*
|
||||
* Copyright (c) 2014-2015 Intel, Inc. All rights reserved.
|
||||
* Copyright (c) 2015 Los Alamos National Security, LLC. All rights
|
||||
* reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
* Additional copyrights may follow
|
||||
@ -26,9 +29,11 @@ static void cleanup_cred(opal_sec_cred_t *cred)
|
||||
}
|
||||
if (NULL != cred->method) {
|
||||
free(cred->method);
|
||||
cred->method = NULL;
|
||||
}
|
||||
if (NULL != cred->credential) {
|
||||
free(cred->credential);
|
||||
cred->credential = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
@ -99,7 +104,7 @@ int opal_sec_base_validate(char *payload, size_t size, char **method)
|
||||
opal_sec_handle_t *hdl;
|
||||
opal_buffer_t buf;
|
||||
int cnt, rc;
|
||||
opal_sec_cred_t cred;
|
||||
opal_sec_cred_t cred = {.method = NULL, .credential = NULL};
|
||||
|
||||
opal_output_verbose(5, opal_sec_base_framework.framework_output,
|
||||
"opal_sec: Received credential of size %lu",
|
||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user