diff options
author | Alexey Fofanov <avoget@gmail.com> | 2023-10-25 14:29:06 +0300 |
---|---|---|
committer | Hugo Landau <hlandau@openssl.org> | 2023-10-26 15:20:44 +0100 |
commit | 90cc6fa8341507bf28467fc70dd819426a574a5d (patch) | |
tree | 927dfc7070cac5893023201192b6a2b46e94bd5c | |
parent | 52d235e1ad2b19675b3ffdd43ec45523974f0344 (diff) |
return 0 if an error occurred
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Paul Dale <pauli@openssl.org>
Reviewed-by: Hugo Landau <hlandau@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/22504)
(cherry picked from commit f0d88b4d070426493749cfd6b657e42dc3c2f5dd)
-rw-r--r-- | crypto/http/http_client.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/crypto/http/http_client.c b/crypto/http/http_client.c index 92481d4751..cd4266ae27 100644 --- a/crypto/http/http_client.c +++ b/crypto/http/http_client.c @@ -488,13 +488,17 @@ static int parse_http_line1(char *line, int *found_keep_alive) static int check_set_resp_len(OSSL_HTTP_REQ_CTX *rctx, size_t len) { - if (rctx->max_resp_len != 0 && len > rctx->max_resp_len) + if (rctx->max_resp_len != 0 && len > rctx->max_resp_len) { ERR_raise_data(ERR_LIB_HTTP, HTTP_R_MAX_RESP_LEN_EXCEEDED, "length=%zu, max=%zu", len, rctx->max_resp_len); - if (rctx->resp_len != 0 && rctx->resp_len != len) + return 0; + } + if (rctx->resp_len != 0 && rctx->resp_len != len) { ERR_raise_data(ERR_LIB_HTTP, HTTP_R_INCONSISTENT_CONTENT_LENGTH, "ASN.1 length=%zu, Content-Length=%zu", len, rctx->resp_len); + return 0; + } rctx->resp_len = len; return 1; } |