summaryrefslogtreecommitdiff
path: root/security/nss/lib/softoken/rsawrapr.c
diff options
context:
space:
mode:
Diffstat (limited to 'security/nss/lib/softoken/rsawrapr.c')
-rw-r--r--security/nss/lib/softoken/rsawrapr.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/security/nss/lib/softoken/rsawrapr.c b/security/nss/lib/softoken/rsawrapr.c
index 5b1b8d894..bb6e454af 100644
--- a/security/nss/lib/softoken/rsawrapr.c
+++ b/security/nss/lib/softoken/rsawrapr.c
@@ -240,6 +240,10 @@ RSA_FormatOneBlock(unsigned modulusLen, RSA_BlockType blockType,
*/
padLen = modulusLen - data->len - 3;
PORT_Assert (padLen >= RSA_BLOCK_MIN_PAD_LEN);
+ if (padLen < RSA_BLOCK_MIN_PAD_LEN) {
+ PORT_Free(block);
+ return NULL;
+ }
for (i = 0; i < padLen; i++) {
/* Pad with non-zero random data. */
do {
@@ -776,6 +780,8 @@ RSA_EncryptBlock(SECKEYLowPublicKey *key,
SECItem unformatted;
formatted.data = NULL;
+ if (modulus_len == 0)
+ goto failure;
if (max_output_len < modulus_len)
goto failure;
PORT_Assert(key->keyType == rsaKey);