hc-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kwri...@apache.org
Subject httpcomponents-client git commit: HTTPCLIENT-1881: Allow truncated NTLM packets to work with this client.
Date Sat, 18 Nov 2017 11:37:37 GMT
Repository: httpcomponents-client
Updated Branches:
  refs/heads/master 235348eec -> 42359353a


HTTPCLIENT-1881: Allow truncated NTLM packets to work with this client.


Project: http://git-wip-us.apache.org/repos/asf/httpcomponents-client/repo
Commit: http://git-wip-us.apache.org/repos/asf/httpcomponents-client/commit/42359353
Tree: http://git-wip-us.apache.org/repos/asf/httpcomponents-client/tree/42359353
Diff: http://git-wip-us.apache.org/repos/asf/httpcomponents-client/diff/42359353

Branch: refs/heads/master
Commit: 42359353a23005b2c12aaa2f98db6c3a47cc53a8
Parents: 235348e
Author: Karl Wright <DaddyWri@gmail.com>
Authored: Sat Nov 18 06:37:27 2017 -0500
Committer: Karl Wright <DaddyWri@gmail.com>
Committed: Sat Nov 18 06:37:27 2017 -0500

----------------------------------------------------------------------
 .../org/apache/hc/client5/http/impl/auth/NTLMEngineImpl.java  | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/42359353/httpclient5/src/main/java/org/apache/hc/client5/http/impl/auth/NTLMEngineImpl.java
----------------------------------------------------------------------
diff --git a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/auth/NTLMEngineImpl.java
b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/auth/NTLMEngineImpl.java
index 3ebb3dc..c8e5db0 100644
--- a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/auth/NTLMEngineImpl.java
+++ b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/auth/NTLMEngineImpl.java
@@ -270,7 +270,7 @@ final class NTLMEngineImpl implements NTLMEngine {
 
     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);
@@ -278,7 +278,7 @@ final class NTLMEngineImpl implements NTLMEngine {
 
     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);
     }
@@ -287,8 +287,7 @@ final class NTLMEngineImpl implements NTLMEngine {
         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);


Mime
View raw message