forked from wolfSSL/wolfssl
fix on TLSX_SNI_GetFromBuffer - undo last fix and return 0 when there is no SNI extension. Now the return is the same when there is no extensions at all.
This commit is contained in:
@ -1047,9 +1047,7 @@ int TLSX_SNI_GetFromBuffer(const byte* clientHello, word32 helloSz,
|
|||||||
len16 -= min(2 * OPAQUE16_LEN + extLen, len16);
|
len16 -= min(2 * OPAQUE16_LEN + extLen, len16);
|
||||||
}
|
}
|
||||||
|
|
||||||
*inOutSz = 0;
|
return len16 ? BUFFER_ERROR : 0;
|
||||||
|
|
||||||
return len16 ? BUFFER_ERROR : SSL_SUCCESS;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
10
tests/api.c
10
tests/api.c
@ -388,17 +388,11 @@ static void test_CyaSSL_SNI_GetFromBuffer(void)
|
|||||||
byte result[32] = {0};
|
byte result[32] = {0};
|
||||||
word32 length = 32;
|
word32 length = 32;
|
||||||
|
|
||||||
AssertIntEQ(SSL_SUCCESS, CyaSSL_SNI_GetFromBuffer(buffer3, sizeof(buffer3),
|
AssertIntEQ(0, CyaSSL_SNI_GetFromBuffer(buffer3, sizeof(buffer3),
|
||||||
0, result, &length));
|
0, result, &length));
|
||||||
AssertIntEQ(XSTRLEN(""), length);
|
|
||||||
|
|
||||||
length = 32;
|
AssertIntEQ(0, CyaSSL_SNI_GetFromBuffer(buffer2, sizeof(buffer2),
|
||||||
|
|
||||||
AssertIntEQ(SSL_SUCCESS, CyaSSL_SNI_GetFromBuffer(buffer2, sizeof(buffer2),
|
|
||||||
1, result, &length));
|
1, result, &length));
|
||||||
AssertIntEQ(XSTRLEN(""), length);
|
|
||||||
|
|
||||||
length = 32;
|
|
||||||
|
|
||||||
AssertIntEQ(-228, CyaSSL_SNI_GetFromBuffer(buffer, sizeof(buffer), 0,
|
AssertIntEQ(-228, CyaSSL_SNI_GetFromBuffer(buffer, sizeof(buffer), 0,
|
||||||
result, &length));
|
result, &length));
|
||||||
|
Reference in New Issue
Block a user