Skip to content

Commit

Permalink
Merge pull request #371 from norrisjeremy/20230802
Browse files Browse the repository at this point in the history
0.2.12 changes
  • Loading branch information
mwiede authored Aug 8, 2023
2 parents 768f70c + e439958 commit ab5587e
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .mvn/wrapper/maven-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.3/apache-maven-3.9.3-bin.zip
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.4/apache-maven-3.9.4-bin.zip
wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar
2 changes: 2 additions & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
* [0.2.12](https://github.com/mwiede/jsch/releases/tag/jsch-0.2.12)
* Further refine previous fixes for windows line endings in PEM keys from [#369](https://github.com/mwiede/jsch/issues/369) & [#362](https://github.com/mwiede/jsch/issues/362).
* [0.2.11](https://github.com/mwiede/jsch/releases/tag/jsch-0.2.11)
* [#369](https://github.com/mwiede/jsch/issues/369) fix multi-line PEM key parsing to work with windows line endings due to regression from previous fix for [#362](https://github.com/mwiede/jsch/issues/362).
* [0.2.10](https://github.com/mwiede/jsch/releases/tag/jsch-0.2.10)
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@
<junixsocket.version>2.6.2</junixsocket.version>
<jna.version>5.13.0</jna.version>
<log4j.version>2.20.0</log4j.version>
<errorprone.version>2.20.0</errorprone.version>
<errorprone.version>2.21.0</errorprone.version>
<surefire.version>3.1.2</surefire.version>
</properties>
<dependencies>
Expand Down
9 changes: 4 additions & 5 deletions src/main/java/com/jcraft/jsch/KeyPair.java
Original file line number Diff line number Diff line change
Expand Up @@ -891,17 +891,16 @@ static KeyPair load(JSch.InstanceLogger instLogger, byte[] prvkey, byte[] pubkey

start = 0;
i = 0;
boolean xds = false;

int _len = _buf.length;
while (i < _len) {
if (_buf[i] == '\n') {
boolean xd = (_buf[i - 1] == '\r');
boolean xd = (i > 0 && _buf[i - 1] == '\r');
// ignore \n (or \r\n)
System.arraycopy(_buf, i + 1, _buf, i - (xd ? 1 : 0), _len - (i + 1));
if (xd) {
_len--;
xds = true;
i--;
}
_len--;
continue;
Expand All @@ -912,8 +911,8 @@ static KeyPair load(JSch.InstanceLogger instLogger, byte[] prvkey, byte[] pubkey
i++;
}

if (i - (xds ? 1 : 0) - start > 0)
data = Util.fromBase64(_buf, start, i - (xds ? 1 : 0) - start);
if (i - start > 0)
data = Util.fromBase64(_buf, start, i - start);

Util.bzero(_buf);
}
Expand Down

0 comments on commit ab5587e

Please sign in to comment.