Skip to content

Commit

Permalink
fixed ArrayIndexOutOfBoundsException in signing
Browse files Browse the repository at this point in the history
Before writing data to a buffer, its available size should be checked.
  • Loading branch information
ymnk committed May 14, 2013
1 parent c23826f commit 58ccf74
Show file tree
Hide file tree
Showing 13 changed files with 18 additions and 12 deletions.
2 changes: 1 addition & 1 deletion README
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ Examples
$ cd examples
$ mvn compile
$ mvn exec:java \
-Dexec.mainClass="com.jcraft.jsch.agentproxy.examples.UsingJSchWithAgentProxy" \
-Dexec.mainClass="com.jcraft.jsch.agentproxy.examples.JSchWithAgentProxy" \
-Dexec.args="foo@bar.com"


Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ This software is licensed under [BSD style license](https://github.com/ymnk/jsch
$ cd examples
$ mvn compile
$ mvn exec:java \
-Dexec.mainClass="com.jcraft.jsch.agentproxy.examples.UsingJSchWithAgentProxy" \
-Dexec.mainClass="com.jcraft.jsch.agentproxy.examples.JSchWithAgentProxy" \
-Dexec.args="foo@bar.com"

## Dependencies
Expand Down
2 changes: 1 addition & 1 deletion examples/README
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,5 @@ README
$ cd examples
$ mvn compile
$ mvn exec:java \
-Dexec.mainClass="com.jcraft.jsch.agentproxy.examples.UsingJSchWithAgentProxy" \
-Dexec.mainClass="com.jcraft.jsch.agentproxy.examples.JSchWithAgentProxy" \
-Dexec.args="foo@bar.com"
2 changes: 1 addition & 1 deletion examples/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

<groupId>com.jcraft</groupId>
<artifactId>jsch.agentproxy.examples</artifactId>
<version>0.0.5</version>
<version>0.0.6</version>
<name>examples to demonstrate how to use jsch-agent-proxy</name>

<dependencies>
Expand Down
2 changes: 1 addition & 1 deletion jsch-agent-proxy-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>com.jcraft</groupId>
<artifactId>jsch.agentproxy</artifactId>
<version>0.0.5</version>
<version>0.0.6</version>
</parent>

<artifactId>jsch.agentproxy.core</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,9 @@ public synchronized byte[] sign(byte[] blob, byte[] data) {
byte code1 = SSH2_AGENTC_SIGN_REQUEST;
byte code2 = SSH2_AGENT_SIGN_RESPONSE;

int required_size = 1 + 4*4 + blob.length + data.length;
buffer.reset();
buffer.checkFreeSize(required_size);
buffer.putByte(code1);
buffer.putString(blob);
buffer.putString(data);
Expand Down Expand Up @@ -150,7 +152,9 @@ public synchronized byte[] sign(byte[] blob, byte[] data) {
public synchronized boolean removeIdentity(byte[] blob) {
byte code1 = SSH2_AGENTC_REMOVE_IDENTITY;

int required_size = 1 + 4*2 + blob.length;
buffer.reset();
buffer.checkFreeSize(required_size);
buffer.putByte(code1);
buffer.putString(blob);
buffer.insertLength();
Expand Down Expand Up @@ -189,7 +193,9 @@ public synchronized void removeAllIdentities() {
public synchronized boolean addIdentity(byte[] identity) {
byte code1 = SSH2_AGENTC_ADD_IDENTITY;

int required_size = 1 + 4 + identity.length;
buffer.reset();
buffer.checkFreeSize(required_size);
buffer.putByte(code1);
buffer.putByte(identity);
buffer.insertLength();
Expand Down
2 changes: 1 addition & 1 deletion jsch-agent-proxy-jsch/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>com.jcraft</groupId>
<artifactId>jsch.agentproxy</artifactId>
<version>0.0.5</version>
<version>0.0.6</version>
</parent>

<artifactId>jsch.agentproxy.jsch</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion jsch-agent-proxy-pageant/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>com.jcraft</groupId>
<artifactId>jsch.agentproxy</artifactId>
<version>0.0.5</version>
<version>0.0.6</version>
</parent>

<artifactId>jsch.agentproxy.pageant</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion jsch-agent-proxy-sshagent/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>com.jcraft</groupId>
<artifactId>jsch.agentproxy</artifactId>
<version>0.0.5</version>
<version>0.0.6</version>
</parent>

<artifactId>jsch.agentproxy.sshagent</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion jsch-agent-proxy-usocket-jna/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>com.jcraft</groupId>
<artifactId>jsch.agentproxy</artifactId>
<version>0.0.5</version>
<version>0.0.6</version>
</parent>

<artifactId>jsch.agentproxy.usocket-jna</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion jsch-agent-proxy-usocket-junixsocket/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>com.jcraft</groupId>
<artifactId>jsch.agentproxy</artifactId>
<version>0.0.5</version>
<version>0.0.6</version>
</parent>

<artifactId>jsch.agentproxy.usocket-junixsocket</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion jsch-agent-proxy-usocket-nc/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>com.jcraft</groupId>
<artifactId>jsch.agentproxy</artifactId>
<version>0.0.5</version>
<version>0.0.6</version>
</parent>

<artifactId>jsch.agentproxy.usocket-nc</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

<groupId>com.jcraft</groupId>
<artifactId>jsch.agentproxy</artifactId>
<version>0.0.5</version>
<version>0.0.6</version>
<packaging>pom</packaging>
<name>jsch-agent-proxy: a parent of modules</name>

Expand Down

0 comments on commit 58ccf74

Please # to comment.