8261969: SNIHostName should check if the encoded hostname conform to RFC 3490

Reviewed-by: rhalade, xuelei
This commit is contained in:
John Jiang 2021-03-02 22:36:28 +00:00
parent c92f3bc37a
commit 4f4d0f5366
2 changed files with 34 additions and 15 deletions

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 2021, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -173,7 +173,8 @@ public final class SNIHostName extends SNIServerName {
.onUnmappableCharacter(CodingErrorAction.REPORT);
this.hostname = IDN.toASCII(
decoder.decode(ByteBuffer.wrap(encoded)).toString());
decoder.decode(ByteBuffer.wrap(encoded)).toString(),
IDN.USE_STD3_ASCII_RULES);
} catch (RuntimeException | CharacterCodingException e) {
throw new IllegalArgumentException(
"The encoded server name value is invalid", e);