check on return values of QSH

This commit is contained in:
Jacob Barthelmeh
2015-09-15 17:46:45 -06:00
parent 764fadeb3b
commit 578ea44e1e

View File

@@ -10226,6 +10226,7 @@ static void PickHashSigAlgo(WOLFSSL* ssl,
{ {
#ifdef HAVE_QSH #ifdef HAVE_QSH
word16 name; word16 name;
int qshSz;
#endif #endif
word16 length = 0; word16 length = 0;
word32 begin = *inOutIdx; word32 begin = *inOutIdx;
@@ -10273,8 +10274,12 @@ static void PickHashSigAlgo(WOLFSSL* ssl,
*inOutIdx += OPAQUE16_LEN; *inOutIdx += OPAQUE16_LEN;
if (name == WOLFSSL_QSH) { if (name == WOLFSSL_QSH) {
*inOutIdx += TLSX_QSHCipher_Parse(ssl, input + *inOutIdx, /* if qshSz is larger than 0 it is the length of buffer
size, 0); used */
if ((qshSz = TLSX_QSHCipher_Parse(ssl, input + *inOutIdx,
size, 0)) < 0)
return qshSz;
*inOutIdx += qshSz;
} }
else { else {
/* unknown extension sent server ignored /* unknown extension sent server ignored
@@ -10974,7 +10979,11 @@ static void PickHashSigAlgo(WOLFSSL* ssl,
*inOutIdx += OPAQUE16_LEN; *inOutIdx += OPAQUE16_LEN;
if (name == WOLFSSL_QSH) { if (name == WOLFSSL_QSH) {
*inOutIdx += TLSX_QSHCipher_Parse(ssl, input + *inOutIdx, size, 0); /* if qshSz is larger than 0 it is the length of buffer used */
if ((qshSz = TLSX_QSHCipher_Parse(ssl, input + *inOutIdx,
size, 0)) < 0)
return qshSz;
*inOutIdx += qshSz;
} }
else { else {
/* unknown extension sent server ignored /* unknown extension sent server ignored
@@ -15156,6 +15165,7 @@ int DoSessionTicket(WOLFSSL* ssl,
{ {
#ifdef HAVE_QSH #ifdef HAVE_QSH
word16 name; word16 name;
int qshSz;
#endif #endif
int ret = 0; int ret = 0;
word32 length = 0; word32 length = 0;
@@ -15275,8 +15285,13 @@ int DoSessionTicket(WOLFSSL* ssl,
*inOutIdx += OPAQUE16_LEN; *inOutIdx += OPAQUE16_LEN;
if (name == WOLFSSL_QSH) { if (name == WOLFSSL_QSH) {
*inOutIdx += TLSX_QSHCipher_Parse(ssl, input /* if qshSz is larger than 0 it is the
+ *inOutIdx, size - *inOutIdx + begin, 1); length of buffer used */
if ((qshSz = TLSX_QSHCipher_Parse(ssl, input
+ *inOutIdx, size - *inOutIdx
+ begin, 1)) < 0)
return qshSz;
*inOutIdx += qshSz;
} }
else { else {
/* unknown extension sent client ignored /* unknown extension sent client ignored
@@ -15348,8 +15363,12 @@ int DoSessionTicket(WOLFSSL* ssl,
*inOutIdx += OPAQUE16_LEN; *inOutIdx += OPAQUE16_LEN;
if (name == WOLFSSL_QSH) { if (name == WOLFSSL_QSH) {
*inOutIdx += TLSX_QSHCipher_Parse(ssl, input + /* if qshSz is larger than 0 it is the length of
*inOutIdx, size - *inOutIdx + begin, 1); buffer used */
if ((qshSz = TLSX_QSHCipher_Parse(ssl, input + *inOutIdx,
size - *inOutIdx + begin, 1)) < 0)
return qshSz;
*inOutIdx += qshSz;
} }
else { else {
/* unknown extension sent client ignored /* unknown extension sent client ignored
@@ -15406,8 +15425,12 @@ int DoSessionTicket(WOLFSSL* ssl,
*inOutIdx += OPAQUE16_LEN; *inOutIdx += OPAQUE16_LEN;
if (name == WOLFSSL_QSH) { if (name == WOLFSSL_QSH) {
*inOutIdx += TLSX_QSHCipher_Parse(ssl, input + /* if qshSz is larger than 0 it is the length of
*inOutIdx, size - *inOutIdx + begin, 1); buffer used */
if ((qshSz = TLSX_QSHCipher_Parse(ssl, input + *inOutIdx,
size - *inOutIdx + begin, 1)) < 0)
return qshSz;
*inOutIdx += qshSz;
} }
else { else {
/* unknown extension sent client ignored /* unknown extension sent client ignored
@@ -15490,8 +15513,12 @@ int DoSessionTicket(WOLFSSL* ssl,
*inOutIdx += OPAQUE16_LEN; *inOutIdx += OPAQUE16_LEN;
if (name == WOLFSSL_QSH) { if (name == WOLFSSL_QSH) {
*inOutIdx += TLSX_QSHCipher_Parse(ssl, input + /* if qshSz is larger than 0 it is the length of
*inOutIdx, size - *inOutIdx + begin, 1); buffer used */
if ((qshSz = TLSX_QSHCipher_Parse(ssl, input + *inOutIdx,
size - *inOutIdx + begin, 1)) < 0)
return qshSz;
*inOutIdx += qshSz;
} }
else { else {
/* unknown extension sent client ignored /* unknown extension sent client ignored
@@ -15541,8 +15568,12 @@ int DoSessionTicket(WOLFSSL* ssl,
*inOutIdx += OPAQUE16_LEN; *inOutIdx += OPAQUE16_LEN;
if (name == WOLFSSL_QSH) { if (name == WOLFSSL_QSH) {
*inOutIdx += TLSX_QSHCipher_Parse(ssl, input + /* if qshSz is larger than 0 it is the length of
*inOutIdx, size - *inOutIdx + begin, 1); buffer used */
if ((qshSz = TLSX_QSHCipher_Parse(ssl, input + *inOutIdx,
size - *inOutIdx + begin, 1)) < 0)
return qshSz;
*inOutIdx += qshSz;
} }
else { else {
/* unknown extension sent client ignored /* unknown extension sent client ignored
@@ -15632,8 +15663,12 @@ int DoSessionTicket(WOLFSSL* ssl,
*inOutIdx += OPAQUE16_LEN; *inOutIdx += OPAQUE16_LEN;
if (name == WOLFSSL_QSH) { if (name == WOLFSSL_QSH) {
*inOutIdx += TLSX_QSHCipher_Parse(ssl, input + /* if qshSz is larger than 0 it is the length of
*inOutIdx, size - *inOutIdx + begin, 1); buffer used */
if ((qshSz = TLSX_QSHCipher_Parse(ssl, input + *inOutIdx,
size - *inOutIdx + begin, 1)) < 0)
return qshSz;
*inOutIdx += qshSz;
} }
else { else {
/* unknown extension sent client ignored /* unknown extension sent client ignored