From: Dr. David von Oheimb Date: Thu, 17 Jun 2021 11:26:32 +0000 (+0200) Subject: http_client.c: make HTTP_LINE1_MINLEN more efficient X-Git-Tag: openssl-3.0.0-beta2~286 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=765860a3cef75b90452c67c4ed63ab17e5d1b862;p=thirdparty%2Fopenssl.git http_client.c: make HTTP_LINE1_MINLEN more efficient Reviewed-by: Tomas Mraz Reviewed-by: Paul Dale (Merged from https://github.com/openssl/openssl/pull/15796) --- diff --git a/crypto/http/http_client.c b/crypto/http/http_client.c index 83bf3c18227..1652a2c9a0e 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 */