summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorLeander Schwarz <lschwarz@mozilla.com>2023-01-16 19:06:46 +0000
committerLeander Schwarz <lschwarz@mozilla.com>2023-01-16 19:06:46 +0000
commit82429b37e9558e9cf672fe5446aa58d16af7d235 (patch)
tree5785ef6285a75217f6dbe3e69ffd14ee42fcf121 /lib
parentf1d7967e22830a08584bc88133932bef98ff622f (diff)
downloadnss-hg-82429b37e9558e9cf672fe5446aa58d16af7d235.tar.gz
Bug 1212915 - Add check for ClientHello SID max length. This is tested by Bogo tests Server-TooLongSessionID-TLS1*. r=djacksonNSS_3_88_BETA1
Depends on D147675 Differential Revision: https://phabricator.services.mozilla.com/D147726
Diffstat (limited to 'lib')
-rw-r--r--lib/ssl/ssl3con.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/ssl/ssl3con.c b/lib/ssl/ssl3con.c
index 103e41581..8e418a458 100644
--- a/lib/ssl/ssl3con.c
+++ b/lib/ssl/ssl3con.c
@@ -8852,7 +8852,9 @@ ssl3_HandleClientHelloPreamble(sslSocket *ss, PRUint8 **b, PRUint32 *length, SEC
/* Grab the client's SID, if present. */
rv = ssl3_ConsumeHandshakeVariable(ss, sidBytes, 1, b, length);
- if (rv != SECSuccess) {
+ /* Check that the SID has the format: opaque legacy_session_id<0..32>, as
+ * specified in RFC8446, Section 4.1.2. */
+ if (rv != SECSuccess || sidBytes->len > SSL3_SESSIONID_BYTES) {
return SECFailure; /* malformed */
}