changeset 14162:cb50526a9629

8242685: Better Path Validation Reviewed-by: alanb, rhalade
author bpb
date Tue, 28 Apr 2020 10:14:25 -0700
parents eca1dcb470d8
children e333a640d78f
files src/solaris/classes/sun/nio/fs/UnixUriUtils.java
diffstat 1 files changed, 3 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/solaris/classes/sun/nio/fs/UnixUriUtils.java	Fri Sep 11 18:58:51 2020 +0300
+++ b/src/solaris/classes/sun/nio/fs/UnixUriUtils.java	Tue Apr 28 10:14:25 2020 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2020, 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
@@ -83,7 +83,8 @@
                 if (b == 0)
                     throw new IllegalArgumentException("Nul character not allowed");
             } else {
-                assert c < 0x80;
+                if (c == 0 || c >= 0x80)
+                    throw new IllegalArgumentException("Bad escape");
                 b = (byte)c;
             }
             result[rlen++] = b;