mirror of
https://github.com/SoftEtherVPN/SoftEtherVPN.git
synced 2024-11-22 09:29:52 +03:00
src/Mayaqua/Secure.c: fix potential null pointer dereference
found by coverity CID 343536 (#1 of 1): Dereference before null check (REVERSE_INULL) check_after_deref: Null-checking name suggests that it may be null, but it has already been dereferenced on all paths leading to the check. 1339 if (name == NULL || data == NULL || size == 0) 1340 { 1341 sec->Error = SEC_ERROR_BAD_PARAMETER; 1342 return false; 1343 }
This commit is contained in:
parent
aadc068964
commit
a89adaebc3
@ -1313,14 +1313,6 @@ bool WriteSecData(SECURE *sec, bool private_obj, char *name, void *data, UINT si
|
||||
UINT object_class = CKO_DATA;
|
||||
CK_BBOOL b_true = true, b_false = false, b_private_obj = private_obj;
|
||||
UINT object;
|
||||
CK_ATTRIBUTE a[] =
|
||||
{
|
||||
{CKA_TOKEN, &b_true, sizeof(b_true)},
|
||||
{CKA_CLASS, &object_class, sizeof(object_class)},
|
||||
{CKA_PRIVATE, &b_private_obj, sizeof(b_private_obj)},
|
||||
{CKA_LABEL, name, StrLen(name)},
|
||||
{CKA_VALUE, data, size},
|
||||
};
|
||||
// Validate arguments
|
||||
if (sec == NULL)
|
||||
{
|
||||
@ -1347,6 +1339,15 @@ bool WriteSecData(SECURE *sec, bool private_obj, char *name, void *data, UINT si
|
||||
return false;
|
||||
}
|
||||
|
||||
CK_ATTRIBUTE a[] =
|
||||
{
|
||||
{CKA_TOKEN, &b_true, sizeof(b_true)},
|
||||
{CKA_CLASS, &object_class, sizeof(object_class)},
|
||||
{CKA_PRIVATE, &b_private_obj, sizeof(b_private_obj)},
|
||||
{CKA_LABEL, name, StrLen(name)},
|
||||
{CKA_VALUE, data, size},
|
||||
};
|
||||
|
||||
// Delete any objects with the same name
|
||||
if (CheckSecObject(sec, name, SEC_DATA))
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user