UPnP: Fix "content not allowed in trailing section" (tickets #481, #1653)

patch from 'kay" in #1653, dev agreement received
This commit is contained in:
zzz
2015-09-04 21:05:38 +00:00
parent 61edd01e3d
commit fe69d3b8f7
3 changed files with 40 additions and 2 deletions

View File

@@ -18,10 +18,10 @@ public class RouterVersion {
/** deprecated */
public final static String ID = "Monotone";
public final static String VERSION = CoreVersion.VERSION;
public final static long BUILD = 4;
public final static long BUILD = 5;
/** for example "-test" */
public final static String EXTRA = "";
public final static String EXTRA = "-rc";
public final static String FULL_VERSION = VERSION + "-" + BUILD + EXTRA;
public static void main(String args[]) {
System.out.println("I2P Router version: " + FULL_VERSION);

View File

@@ -184,6 +184,40 @@ public class JaxpParser extends Parser
}
return rv;
}
/** @since 0.9.22 */
@Override
public int read(byte[] b) throws IOException {
return this.read(b, 0, b.length);
}
/** @since 0.9.22 */
@Override
public int read(byte[] b, int off, int len) throws IOException {
if (b == null) {
throw new NullPointerException();
} else if (off < 0 || len < 0 || len > b.length - off) {
throw new IndexOutOfBoundsException();
} else if (len == 0) {
return 0;
}
int rv = this.read();
if (-1 == rv) {
return -1;
}
int i = 1;
b[off] = (byte) rv;
for (; i < len; i++) {
rv = this.read();
if (-1 == rv) {
break;
}
b[off + i] = (byte) rv;
}
return i;
}
}
/**