mirror of
https://github.com/wolfSSL/wolfssl.git
synced 2025-08-03 20:54:41 +02:00
Fix to make sure wc_RNG_GenerateBlock
return code is checked in test.h GetRandomPort
.
This commit is contained in:
@@ -2970,8 +2970,9 @@ static WC_INLINE word16 GetRandomPort(void)
|
||||
/* Generate random port for testing */
|
||||
WC_RNG rng;
|
||||
if (wc_InitRng(&rng) == 0) {
|
||||
wc_RNG_GenerateBlock(&rng, (byte*)&port, sizeof(port));
|
||||
if (wc_RNG_GenerateBlock(&rng, (byte*)&port, sizeof(port)) == 0) {
|
||||
port |= 0xC000; /* Make sure its in the 49152 - 65535 range */
|
||||
}
|
||||
wc_FreeRng(&rng);
|
||||
}
|
||||
(void)rng; /* for WC_NO_RNG case */
|
||||
|
Reference in New Issue
Block a user