mirror of
https://github.com/wolfSSL/wolfssl.git
synced 2025-08-02 20:24:39 +02:00
fix for scan build warning and better check on size
This commit is contained in:
@@ -26821,14 +26821,14 @@ static int DecodeAsymKey(const byte* input, word32* inOutIdx, word32 inSz,
|
|||||||
if (GetOctetString(input, inOutIdx, &privSz, inSz) < 0)
|
if (GetOctetString(input, inOutIdx, &privSz, inSz) < 0)
|
||||||
return ASN_PARSE_E;
|
return ASN_PARSE_E;
|
||||||
|
|
||||||
if ((word32)privSz > *privKeyLen)
|
|
||||||
return BUFFER_E;
|
|
||||||
|
|
||||||
priv = input + *inOutIdx;
|
priv = input + *inOutIdx;
|
||||||
*inOutIdx += privSz;
|
*inOutIdx += privSz;
|
||||||
endKeyIdx = *inOutIdx;
|
endKeyIdx = *inOutIdx;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ((word32)privSz > *privKeyLen)
|
||||||
|
return BUFFER_E;
|
||||||
|
|
||||||
if (endKeyIdx == (int)*inOutIdx) {
|
if (endKeyIdx == (int)*inOutIdx) {
|
||||||
*privKeyLen = privSz;
|
*privKeyLen = privSz;
|
||||||
XMEMCPY(privKey, priv, *privKeyLen);
|
XMEMCPY(privKey, priv, *privKeyLen);
|
||||||
@@ -26836,6 +26836,10 @@ static int DecodeAsymKey(const byte* input, word32* inOutIdx, word32 inSz,
|
|||||||
*pubKeyLen = 0;
|
*pubKeyLen = 0;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
if (pubKeyLen == NULL) {
|
||||||
|
return BAD_FUNC_ARG;
|
||||||
|
}
|
||||||
|
|
||||||
if (GetASNHeader(input, ASN_CONTEXT_SPECIFIC | ASN_CONSTRUCTED | 1,
|
if (GetASNHeader(input, ASN_CONTEXT_SPECIFIC | ASN_CONSTRUCTED | 1,
|
||||||
inOutIdx, &length, inSz) < 0) {
|
inOutIdx, &length, inSz) < 0) {
|
||||||
return ASN_PARSE_E;
|
return ASN_PARSE_E;
|
||||||
|
Reference in New Issue
Block a user