mirror of
https://github.com/apache/httpcomponents-client.git
synced 2025-03-08 17:59:51 +00:00
HTTPCLIENT-1881: Allow truncated NTLM packets to work with this client.
This commit is contained in:
parent
d6db9ab3d0
commit
97eee9e0e0
@ -211,7 +211,7 @@ static String getType3Message(final String user, final String password, final St
|
||||
|
||||
private static int readULong(final byte[] src, final int index) throws NTLMEngineException {
|
||||
if (src.length < index + 4) {
|
||||
throw new NTLMEngineException("NTLM authentication - buffer too small for DWORD");
|
||||
return 0;
|
||||
}
|
||||
return (src[index] & 0xff) | ((src[index + 1] & 0xff) << 8)
|
||||
| ((src[index + 2] & 0xff) << 16) | ((src[index + 3] & 0xff) << 24);
|
||||
@ -219,7 +219,7 @@ private static int readULong(final byte[] src, final int index) throws NTLMEngin
|
||||
|
||||
private static int readUShort(final byte[] src, final int index) throws NTLMEngineException {
|
||||
if (src.length < index + 2) {
|
||||
throw new NTLMEngineException("NTLM authentication - buffer too small for WORD");
|
||||
return 0;
|
||||
}
|
||||
return (src[index] & 0xff) | ((src[index + 1] & 0xff) << 8);
|
||||
}
|
||||
@ -228,8 +228,7 @@ private static byte[] readSecurityBuffer(final byte[] src, final int index) thro
|
||||
final int length = readUShort(src, index);
|
||||
final int offset = readULong(src, index + 4);
|
||||
if (src.length < offset + length) {
|
||||
throw new NTLMEngineException(
|
||||
"NTLM authentication - buffer too small for data item");
|
||||
return new byte[length];
|
||||
}
|
||||
final byte[] buffer = new byte[length];
|
||||
System.arraycopy(src, offset, buffer, 0, length);
|
||||
|
Loading…
x
Reference in New Issue
Block a user