File tree Expand file tree Collapse file tree 3 files changed +14
-1
lines changed
Expand file tree Collapse file tree 3 files changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -86,7 +86,7 @@ namespace
8686
8787 VALIDATE_RETURN (nextTag (stream, tag, len));
8888
89- if (tag != TAG_INT) {
89+ if (tag != TAG_INT || len > 1024 * 1024 * 10 ) {
9090 return false ;
9191 }
9292
Original file line number Diff line number Diff line change @@ -177,6 +177,18 @@ void TestOpenSSHKey::testParseRSA()
177177 QCOMPARE (key.fingerprint (QCryptographicHash::Md5), QString (" MD5:c2:26:5b:3d:62:19:56:b0:c3:67:99:7a:a6:4c:66:06" ));
178178}
179179
180+ void TestOpenSSHKey::testParseRSABroken ()
181+ {
182+ const QString keyString = QString (" -----BEGIN RSA PRIVATE KEY-----\n "
183+ " MAACAQAChH////8=\n "
184+ " -----END RSA PRIVATE KEY-----\n " );
185+
186+ const QByteArray keyData = keyString.toLatin1 ();
187+
188+ OpenSSHKey key;
189+ QVERIFY (!key.parsePKCS1PEM (keyData));
190+ }
191+
180192void TestOpenSSHKey::testParseRSACompare ()
181193{
182194 const QString oldKeyString = QString (" -----BEGIN RSA PRIVATE KEY-----\n "
Original file line number Diff line number Diff line change @@ -31,6 +31,7 @@ private slots:
3131 void testParse ();
3232 void testParseDSA ();
3333 void testParseRSA ();
34+ void testParseRSABroken ();
3435 void testParseRSACompare ();
3536 void testParseECDSA256 ();
3637 void testParseECDSA384 ();
You can’t perform that action at this time.
0 commit comments