Changeset 5fcafb6


Ignore:
Timestamp:
Aug 2, 2016 2:28:34 PM (4 years ago)
Author:
zzz <zzz@…>
Branches:
master
Children:
9c0ae146
Parents:
5763d73
Message:

i2psnark: Fix SIOOBE on bad announce URL (ticket #1823)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • apps/i2psnark/java/src/org/klomp/snark/TrackerClient.java

    r5763d73 r5fcafb6  
    894894        return false;
    895895    }
     896    String path = url.getPath();
     897    if (path == null || !path.startsWith("/"))
     898        return false;
    896899    return "http".equals(url.getScheme()) && url.getHost() != null &&
    897900           (url.getHost().endsWith(".i2p") || url.getHost().equals("i2p"));
     
    899902
    900903  /**
     904   *  This also validates the URL.
     905   *
    901906   *  @param ann an announce URL non-null
    902907   *  @return a Hash for i2p hosts only, null otherwise
     
    915920    if (host == null)
    916921        return null;
    917     if (host.endsWith(".i2p"))
     922    if (host.endsWith(".i2p")) {
     923        String path = url.getPath();
     924        if (path == null || !path.startsWith("/"))
     925            return null;
    918926        return ConvertToHash.getHash(host);
     927    }
    919928    if (host.equals("i2p")) {
    920929        String path = url.getPath();
     
    942951      int seenPeers;
    943952
     953      /**
     954       *  @param a must be a valid http URL with a path
     955       *  @param p true if primary
     956       */
    944957      public TCTracker(String a, boolean p)
    945958      {
Note: See TracChangeset for help on using the changeset viewer.