summaryrefslogtreecommitdiff
path: root/lib/sha256.c
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2018-08-13 12:12:14 +0200
committerDaniel Stenberg <daniel@haxx.se>2018-08-13 23:16:01 +0200
commit8440616f53056b2330393d1b0740c89a30376c67 (patch)
treeea2ea2300488f3c792ff7cf2a86e5047a3814e2f /lib/sha256.c
parent233908a55aa041d1ad3d901f9c3b8e3b1ebd3d55 (diff)
downloadcurl-8440616f53056b2330393d1b0740c89a30376c67.tar.gz
http: fix for tiny "HTTP/0.9" response
Deal with tiny "HTTP/0.9" (header-less) responses by checking the status-line early, even before a full "HTTP/" is received to allow detecting 0.9 properly. Test 1266 and 1267 added to verify. Fixes #2420 Closes #2872
Diffstat (limited to 'lib/sha256.c')
-rw-r--r--lib/sha256.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/lib/sha256.c b/lib/sha256.c
index 3ac129612..f9287af23 100644
--- a/lib/sha256.c
+++ b/lib/sha256.c
@@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2016, Florin Petriuc, <petriuc.florin@gmail.com>
+ * Copyright (C) 1998 - 2018, Florin Petriuc, <petriuc.florin@gmail.com>
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
@@ -123,9 +123,6 @@ static const unsigned long K[64] = {
#define Sigma1(x) (S(x, 6) ^ S(x, 11) ^ S(x, 25))
#define Gamma0(x) (S(x, 7) ^ S(x, 18) ^ R(x, 3))
#define Gamma1(x) (S(x, 17) ^ S(x, 19) ^ R(x, 10))
-#ifndef MIN
-#define MIN(x, y) (((x) < (y)) ? (x) : (y))
-#endif
/* compress 512-bits */
static int sha256_compress(struct sha256_state *md,
unsigned char *buf)
@@ -200,7 +197,7 @@ static int SHA256_Update(struct sha256_state *md,
inlen -= block_size;
}
else {
- n = MIN(inlen, (block_size - md->curlen));
+ n = CURLMIN(inlen, (block_size - md->curlen));
memcpy(md->buf + md->curlen, in, n);
md->curlen += n;
in += n;