[armedbear-cvs] r11815 - trunk/abcl/src/org/armedbear/lisp
Erik Huelsmann
ehuelsmann at common-lisp.net
Sat May 2 20:40:55 UTC 2009
Author: ehuelsmann
Date: Sat May 2 16:40:54 2009
New Revision: 11815
Log:
Be sure to decode URL.getPath() results before
using it as paths. Result from an audit after
finding we didn't build on paths with spaces in them.
Modified:
trunk/abcl/src/org/armedbear/lisp/Load.java
trunk/abcl/src/org/armedbear/lisp/Pathname.java
Modified: trunk/abcl/src/org/armedbear/lisp/Load.java
==============================================================================
--- trunk/abcl/src/org/armedbear/lisp/Load.java (original)
+++ trunk/abcl/src/org/armedbear/lisp/Load.java Sat May 2 16:40:54 2009
@@ -39,6 +39,7 @@
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
+import java.net.URLDecoder;
import java.util.zip.ZipEntry;
import java.util.zip.ZipException;
import java.util.zip.ZipFile;
@@ -508,7 +509,15 @@
private static final String getPath(URL url)
{
if (url != null) {
- String path = url.getPath();
+ String path;
+ try {
+ path = URLDecoder.decode(url.getPath(),"UTF-8");
+ }
+ catch (java.io.UnsupportedEncodingException uee) {
+ // Can't happen: every Java is supposed to support
+ // at least UTF-8 encoding
+ path = null;
+ }
if (path != null) {
if (Utilities.isPlatformWindows) {
if (path.length() > 0 && path.charAt(0) == '/')
Modified: trunk/abcl/src/org/armedbear/lisp/Pathname.java
==============================================================================
--- trunk/abcl/src/org/armedbear/lisp/Pathname.java (original)
+++ trunk/abcl/src/org/armedbear/lisp/Pathname.java Sat May 2 16:40:54 2009
@@ -36,6 +36,7 @@
import java.io.File;
import java.io.IOException;
import java.net.URL;
+import java.net.URLDecoder;
import java.util.StringTokenizer;
public class Pathname extends LispObject
@@ -66,7 +67,15 @@
{
String protocol = url.getProtocol();
if ("jar".equals(protocol)) {
- String s = url.getPath();
+ String s;
+ try {
+ s = URLDecoder.decode(url.getPath(),"UTF-8");
+ }
+ catch (java.io.UnsupportedEncodingException uee) {
+ // Can't happen: every Java is supposed to support
+ // at least UTF-8 encoding
+ s = null;
+ }
if (s.startsWith("file:")) {
int index = s.indexOf("!/");
String container = s.substring(5, index);
@@ -83,7 +92,15 @@
return;
}
} else if ("file".equals(protocol)) {
- String s = url.getPath();
+ String s;
+ try {
+ s = URLDecoder.decode(url.getPath(),"UTF-8");
+ }
+ catch (java.io.UnsupportedEncodingException uee) {
+ // Can't happen: every Java is supposed to support
+ // at least UTF-8 encoding
+ s = null;
+ }
if (s != null && s.startsWith("file:")) {
init(s.substring(5));
return;
More information about the armedbear-cvs
mailing list