summaryrefslogtreecommitdiffstats
path: root/crypto/http/http_client.c
diff options
context:
space:
mode:
authorJiasheng Jiang <jiasheng@iscas.ac.cn>2022-06-22 16:41:12 +0800
committerTomas Mraz <tomas@openssl.org>2022-06-23 12:35:48 +0200
commit2a171e13da1accd296fd1790c6e99c136b985704 (patch)
tree204fdef44b00313719e29c0fa498a08c9a6b6648 /crypto/http/http_client.c
parenta1f7034bbd8f0730d360211f5ba0feeaef0b7b2c (diff)
crypto/http/http_client.c: Add the check for OPENSSL_strdup
As the potential failure of the OPENSSL_strdup(), it should be better to check the return value and return error if fails. Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn> Reviewed-by: Paul Dale <pauli@openssl.org> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/18624) (cherry picked from commit 816d6e578ccc4d8ae41de77e3069762d03079d18)
Diffstat (limited to 'crypto/http/http_client.c')
-rw-r--r--crypto/http/http_client.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/crypto/http/http_client.c b/crypto/http/http_client.c
index 59a3445813..2520d71f2f 100644
--- a/crypto/http/http_client.c
+++ b/crypto/http/http_client.c
@@ -1135,6 +1135,14 @@ BIO *OSSL_HTTP_get(const char *url, const char *proxy, const char *no_proxy,
current_url = redirection_url;
if (*redirection_url == '/') { /* redirection to same server */
path = OPENSSL_strdup(redirection_url);
+ if (path == NULL) {
+ OPENSSL_free(host);
+ OPENSSL_free(port);
+ (void)OSSL_HTTP_close(rctx, 1);
+ BIO_free(resp);
+ OPENSSL_free(current_url);
+ return NULL;
+ }
goto new_rpath;
}
OPENSSL_free(host);