Changeset 11815


Ignore:
Timestamp:
05/02/09 20:40:54 (13 years ago)
Author:
ehuelsmann
Message:

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.

Location:
trunk/abcl/src/org/armedbear/lisp
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/abcl/src/org/armedbear/lisp/Load.java

    r11783 r11815  
    4040import java.io.InputStream;
    4141import java.net.URL;
     42import java.net.URLDecoder;
    4243import java.util.zip.ZipEntry;
    4344import java.util.zip.ZipException;
     
    509510    {
    510511        if (url != null) {
    511             String path = url.getPath();
     512            String path;
     513            try {
     514                path = URLDecoder.decode(url.getPath(),"UTF-8");
     515            }
     516            catch (java.io.UnsupportedEncodingException uee) {
     517                // Can't happen: every Java is supposed to support
     518                // at least UTF-8 encoding
     519                path = null;
     520            }
    512521            if (path != null) {
    513522                if (Utilities.isPlatformWindows) {
  • trunk/abcl/src/org/armedbear/lisp/Pathname.java

    r11766 r11815  
    3737import java.io.IOException;
    3838import java.net.URL;
     39import java.net.URLDecoder;
    3940import java.util.StringTokenizer;
    4041
     
    6768        String protocol = url.getProtocol();
    6869        if ("jar".equals(protocol)) {
    69             String s = url.getPath();
     70            String s;
     71            try {
     72                s = URLDecoder.decode(url.getPath(),"UTF-8");
     73            }
     74            catch (java.io.UnsupportedEncodingException uee) {
     75                // Can't happen: every Java is supposed to support
     76                // at least UTF-8 encoding
     77                s = null;
     78            }
    7079            if (s.startsWith("file:")) {
    7180                int index = s.indexOf("!/");
     
    8493            }
    8594        } else if ("file".equals(protocol)) {
    86             String s = url.getPath();
     95            String s;
     96            try {
     97                s = URLDecoder.decode(url.getPath(),"UTF-8");
     98            }
     99            catch (java.io.UnsupportedEncodingException uee) {
     100                // Can't happen: every Java is supposed to support
     101                // at least UTF-8 encoding
     102                s = null;
     103            }
    87104            if (s != null && s.startsWith("file:")) {
    88105                init(s.substring(5));
Note: See TracChangeset for help on using the changeset viewer.