Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 7BE9E200D40 for ; Sat, 18 Nov 2017 12:56:08 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id 7A7A5160C0B; Sat, 18 Nov 2017 11:56:08 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id C1E3B160BF7 for ; Sat, 18 Nov 2017 12:56:07 +0100 (CET) Received: (qmail 638 invoked by uid 500); 18 Nov 2017 11:56:07 -0000 Mailing-List: contact commits-help@hc.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "HttpComponents Project" Delivered-To: mailing list commits@hc.apache.org Received: (qmail 626 invoked by uid 99); 18 Nov 2017 11:56:07 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 18 Nov 2017 11:56:07 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id DF7F1DFE1E; Sat, 18 Nov 2017 11:56:06 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: kwright@apache.org To: commits@hc.apache.org Message-Id: <025fa9a7b49d4aa6bc1dd94769e0e157@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: httpcomponents-client git commit: HTTPCLIENT-1881: Allow truncated NTLM packets to work with this client. Date: Sat, 18 Nov 2017 11:56:06 +0000 (UTC) archived-at: Sat, 18 Nov 2017 11:56:08 -0000 Repository: httpcomponents-client Updated Branches: refs/heads/4.5.x d6db9ab3d -> 97eee9e0e 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/97eee9e0 Tree: http://git-wip-us.apache.org/repos/asf/httpcomponents-client/tree/97eee9e0 Diff: http://git-wip-us.apache.org/repos/asf/httpcomponents-client/diff/97eee9e0 Branch: refs/heads/4.5.x Commit: 97eee9e0e0adcb917db20550225db717238f6982 Parents: d6db9ab Author: Karl Wright Authored: Sat Nov 18 06:54:59 2017 -0500 Committer: Karl Wright Committed: Sat Nov 18 06:55:59 2017 -0500 ---------------------------------------------------------------------- .../main/java/org/apache/http/impl/auth/NTLMEngineImpl.java | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/97eee9e0/httpclient/src/main/java/org/apache/http/impl/auth/NTLMEngineImpl.java ---------------------------------------------------------------------- diff --git a/httpclient/src/main/java/org/apache/http/impl/auth/NTLMEngineImpl.java b/httpclient/src/main/java/org/apache/http/impl/auth/NTLMEngineImpl.java index a8d1472..6ed5c0e 100644 --- a/httpclient/src/main/java/org/apache/http/impl/auth/NTLMEngineImpl.java +++ b/httpclient/src/main/java/org/apache/http/impl/auth/NTLMEngineImpl.java @@ -211,7 +211,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); @@ -219,7 +219,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); } @@ -228,8 +228,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);