summaryrefslogtreecommitdiffstats
path: root/crypto/http
diff options
context:
space:
mode:
authorDr. David von Oheimb <David.von.Oheimb@siemens.com>2021-06-17 13:26:32 +0200
committerDr. David von Oheimb <dev@ddvo.net>2021-06-18 14:29:19 +0200
commit765860a3cef75b90452c67c4ed63ab17e5d1b862 (patch)
tree27ad1c210fa6fb8313194c444be243ebf6874684 /crypto/http
parentb6fec9658beacba614d899a9b22e023ae86a41a1 (diff)
http_client.c: make HTTP_LINE1_MINLEN more efficient
Reviewed-by: Tomas Mraz <tomas@openssl.org> Reviewed-by: Paul Dale <pauli@openssl.org> (Merged from https://github.com/openssl/openssl/pull/15796)
Diffstat (limited to 'crypto/http')
-rw-r--r--crypto/http/http_client.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/crypto/http/http_client.c b/crypto/http/http_client.c
index 83bf3c1822..1652a2c9a0 100644
--- a/crypto/http/http_client.c
+++ b/crypto/http/http_client.c
@@ -29,7 +29,7 @@
#define HTTP_PREFIX_VERSION HTTP_PREFIX""HTTP_VERSION_PATT
#define HTTP_1_0 HTTP_PREFIX_VERSION"0" /* "HTTP/1.0" */
#define HTTP_VERSION_STR_LEN (strlen(HTTP_PREFIX_VERSION) + 1)
-#define HTTP_LINE1_MINLEN ((int)strlen(HTTP_PREFIX_VERSION "x 200\n"))
+#define HTTP_LINE1_MINLEN (sizeof(HTTP_PREFIX_VERSION "x 200\n") - 1)
#define HTTP_VERSION_MAX_REDIRECTIONS 50
#define HTTP_STATUS_CODE_OK 200
@@ -1292,7 +1292,7 @@ int OSSL_HTTP_proxy_connect(BIO *bio, const char *server, const char *port,
*/
read_len = BIO_gets(fbio, mbuf, BUF_SIZE);
/* the BIO may not block, so we must wait for the 1st line to come in */
- if (read_len < HTTP_LINE1_MINLEN)
+ if (read_len < (int)HTTP_LINE1_MINLEN)
continue;
/* Check for HTTP/1.x */