summaryrefslogtreecommitdiffstats
path: root/CryptoPkg/Library/BaseCryptLib/Rand/CryptRandTsc.c
diff options
context:
space:
mode:
Diffstat (limited to 'CryptoPkg/Library/BaseCryptLib/Rand/CryptRandTsc.c')
-rw-r--r--CryptoPkg/Library/BaseCryptLib/Rand/CryptRandTsc.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/CryptoPkg/Library/BaseCryptLib/Rand/CryptRandTsc.c b/CryptoPkg/Library/BaseCryptLib/Rand/CryptRandTsc.c
index bb8783d354..7259ed50da 100644
--- a/CryptoPkg/Library/BaseCryptLib/Rand/CryptRandTsc.c
+++ b/CryptoPkg/Library/BaseCryptLib/Rand/CryptRandTsc.c
@@ -41,6 +41,10 @@ RandomSeed (
{
CHAR8 DefaultSeed[128];
+ if (SeedSize > INT_MAX) {
+ return FALSE;
+ }
+
//
// Seed the pseudorandom number generator with user-supplied value.
// NOTE: A cryptographic PRNG must be seeded with unpredictable data.
@@ -86,7 +90,7 @@ RandomBytes (
//
// Check input parameters.
//
- if (Output == NULL) {
+ if (Output == NULL || Size > INT_MAX) {
return FALSE;
}