Line 0
Link Here
|
|
|
1 |
commit 3fbc7cd331602c76f882d1b507cd05c1d824ba8b |
2 |
Author: Matthias Andree <matthias.andree@gmx.de> |
3 |
Date: Mon Aug 13 20:48:12 2012 +0200 |
4 |
|
5 |
Fix crash: Handle invalid base64 in NTLM challenge. |
6 |
|
7 |
Some servers, for instance the MS Exchange servers deployed by the |
8 |
US-American National Aeronautics and Space Administration (NASA), |
9 |
aborted the NTLM protocol exchange after receiving the initial request. |
10 |
|
11 |
Fetchmail did not detect that there was an error message, rather than |
12 |
NTLM protocol exchange, and caught a segmentation fault while reading |
13 |
from a bad location. |
14 |
|
15 |
Detect base64 decoding errors, and return PS_AUTHFAIL in this case. |
16 |
|
17 |
Reported by J[ames] Porter Clark. |
18 |
|
19 |
diff --git a/ntlmsubr.c b/ntlmsubr.c |
20 |
index f9d2733..9321d26 100644 |
21 |
--- a/ntlmsubr.c |
22 |
+++ b/ntlmsubr.c |
23 |
@@ -55,7 +55,14 @@ int ntlm_helper(int sock, struct query *ctl, const char *proto) |
24 |
if ((result = gen_recv(sock, msgbuf, sizeof msgbuf))) |
25 |
goto cancelfail; |
26 |
|
27 |
- (void)from64tobits (&challenge, msgbuf, sizeof(challenge)); |
28 |
+ if ((result = from64tobits (&challenge, msgbuf, sizeof(challenge))) < 0) |
29 |
+ { |
30 |
+ report (stderr, GT_("could not decode BASE64 challenge\n")); |
31 |
+ /* We do not goto cancelfail; the server has already sent the |
32 |
+ * tagged reply, so the protocol exchange has ended, no need |
33 |
+ * for us to send the asterisk. */ |
34 |
+ return PS_AUTHFAIL; |
35 |
+ } |
36 |
|
37 |
if (outlevel >= O_DEBUG) |
38 |
dumpSmbNtlmAuthChallenge(stdout, &challenge); |