Skip to content

Commit ff3e558

Browse files
Brian Burkhalterslowhog
authored andcommitted
8242685: Better Path Validation
Reviewed-by: alanb, rhalade
1 parent a5cb23e commit ff3e558

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/java.base/unix/classes/sun/nio/fs/UnixUriUtils.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2008, 2020, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -83,7 +83,8 @@ static Path fromUri(UnixFileSystem fs, URI uri) {
8383
if (b == 0)
8484
throw new IllegalArgumentException("Nul character not allowed");
8585
} else {
86-
assert c < 0x80;
86+
if (c == 0 || c >= 0x80)
87+
throw new IllegalArgumentException("Bad escape");
8788
b = (byte)c;
8889
}
8990
result[rlen++] = b;

0 commit comments

Comments
 (0)