Skip to content

Commit a176fd8

Browse files
MegaManSecsquid-anubis
authored andcommitted
Quit NTLM authenticate() on missing NTLM authorization header (#2216)
Previously, various null-pointer dereferences, UAFs, and so on occurred.
1 parent 5725a54 commit a176fd8

File tree

1 file changed

+12
-9
lines changed

1 file changed

+12
-9
lines changed

src/auth/ntlm/UserRequest.cc

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -186,20 +186,23 @@ Auth::Ntlm::UserRequest::authenticate(HttpRequest * aRequest, ConnStateData * co
186186
/* get header */
187187
const char *proxy_auth = aRequest->header.getStr(type);
188188

189+
/* if proxy_auth is actually NULL, we'd better not manipulate it. */
190+
if (!proxy_auth) {
191+
debugs(29, 4, "WARNING: NTLM Authentication missing authorization header");
192+
return;
193+
}
194+
189195
/* locate second word */
190196
const char *blob = proxy_auth;
191197

192-
/* if proxy_auth is actually NULL, we'd better not manipulate it. */
193-
if (blob) {
194-
while (xisspace(*blob) && *blob)
195-
++blob;
198+
while (xisspace(*blob) && *blob)
199+
++blob;
196200

197-
while (!xisspace(*blob) && *blob)
198-
++blob;
201+
while (!xisspace(*blob) && *blob)
202+
++blob;
199203

200-
while (xisspace(*blob) && *blob)
201-
++blob;
202-
}
204+
while (xisspace(*blob) && *blob)
205+
++blob;
203206

204207
switch (user()->credentials()) {
205208

0 commit comments

Comments
 (0)