diff --git a/src/java/net/i2p/i2pcontrol/servlets/jsonrpc2handlers/NetworkSettingHandler.java b/src/java/net/i2p/i2pcontrol/servlets/jsonrpc2handlers/NetworkSettingHandler.java index cc09dc0..6726c97 100644 --- a/src/java/net/i2p/i2pcontrol/servlets/jsonrpc2handlers/NetworkSettingHandler.java +++ b/src/java/net/i2p/i2pcontrol/servlets/jsonrpc2handlers/NetworkSettingHandler.java @@ -250,12 +250,13 @@ public class NetworkSettingHandler implements RequestHandler { Integer percent; try{ percent = Integer.parseInt(inParam); - if (percent < 0) + if (percent < 0 || percent > 100 || inParam.length() == 0) { throw new NumberFormatException(); + } } catch (NumberFormatException e){ return new JSONRPC2Response( new JSONRPC2Error(JSONRPC2Error.INVALID_PARAMS.getCode(), - "\"i2p.router.net.bw.share\" A positive integer must supplied, " + inParam + " isn't valid"), + "\"i2p.router.net.bw.share\" A positive integer must supplied, \"" + inParam + "\" isn't valid"), req.getID()); } _context.router().saveConfig(Router.PROP_BANDWIDTH_SHARE_PERCENTAGE, inParam); @@ -272,8 +273,9 @@ public class NetworkSettingHandler implements RequestHandler { Integer rate; try{ rate = Integer.parseInt(inParam); - if (rate < 0) + if (rate < 0 || inParam.length() == 0) { throw new NumberFormatException(); + } } catch (NumberFormatException e){ return new JSONRPC2Response( new JSONRPC2Error(JSONRPC2Error.INVALID_PARAMS.getCode(), @@ -301,7 +303,7 @@ public class NetworkSettingHandler implements RequestHandler { Integer rate; try{ rate = Integer.parseInt(inParam); - if (rate < 0) + if (rate < 0 || inParam.length() == 0) throw new NumberFormatException(); } catch (NumberFormatException e){ return new JSONRPC2Response(