Skip to content

Commit

Permalink
Added null check and rename field
Browse files Browse the repository at this point in the history
  • Loading branch information
hierynomus committed May 11, 2023
1 parent 5f1b9de commit 9055e3a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,9 @@ public byte[] getNTLMv2ClientChallenge(TargetInfo targetInformation) {
ccBuf.putLong(nowAsFileTime); // Timestamp (8)
ccBuf.putRawBytes(challengeFromClient); // ChallengeFromClient (8)
ccBuf.putUInt32(0); // Reserved3 (4)
targetInformation.writeTo(ccBuf); // AvPairs (variable)
if (targetInformation != null) {
targetInformation.writeTo(ccBuf); // AvPairs (variable)
}
ccBuf.putUInt32(0); // Last AV Pair indicator

return ccBuf.getCompactData();
Expand Down
10 changes: 5 additions & 5 deletions src/main/java/com/hierynomus/ntlm/messages/NtlmAuthenticate.java
Original file line number Diff line number Diff line change
Expand Up @@ -124,12 +124,12 @@ public byte[] getVersion() {
return plainBuffer.getCompactData();
}

private int writeOffsettedByteArrayFields(Buffer.PlainBuffer buffer, byte[] array, int offset) {
byte[] _array = array != null ? array : EMPTY;
buffer.putUInt16(_array.length); // ArrayLen
buffer.putUInt16(_array.length); // ArrayMaxLen
private int writeOffsettedByteArrayFields(Buffer.PlainBuffer buffer, byte[] bytes, int offset) {
byte[] arr = bytes != null ? bytes : EMPTY;
buffer.putUInt16(arr.length); // ArrayLen
buffer.putUInt16(arr.length); // ArrayMaxLen
buffer.putUInt32(offset); // ArrayOffset
return offset + _array.length;
return offset + arr.length;
}

private byte[] ensureNotNull(byte[] possiblyNull) {
Expand Down

0 comments on commit 9055e3a

Please sign in to comment.