Tue, 28 Apr 2020 10:14:25 -0700
8242685: Better Path Validation
Reviewed-by: alanb, rhalade
src/solaris/classes/sun/nio/fs/UnixUriUtils.java | file | annotate | diff | comparison | revisions |
1.1 --- a/src/solaris/classes/sun/nio/fs/UnixUriUtils.java Fri Sep 11 18:58:51 2020 +0300 1.2 +++ b/src/solaris/classes/sun/nio/fs/UnixUriUtils.java Tue Apr 28 10:14:25 2020 -0700 1.3 @@ -1,5 +1,5 @@ 1.4 /* 1.5 - * Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved. 1.6 + * Copyright (c) 2008, 2020, Oracle and/or its affiliates. All rights reserved. 1.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 1.8 * 1.9 * This code is free software; you can redistribute it and/or modify it 1.10 @@ -83,7 +83,8 @@ 1.11 if (b == 0) 1.12 throw new IllegalArgumentException("Nul character not allowed"); 1.13 } else { 1.14 - assert c < 0x80; 1.15 + if (c == 0 || c >= 0x80) 1.16 + throw new IllegalArgumentException("Bad escape"); 1.17 b = (byte)c; 1.18 } 1.19 result[rlen++] = b;