Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

0.2.12 changes #371

Merged
merged 3 commits into from
Aug 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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