diff options
author | Seonah Moon <seonah1.moon@samsung.com> | 2016-10-04 16:35:59 +0900 |
---|---|---|
committer | Seonah Moon <seonah1.moon@samsung.com> | 2016-10-04 16:37:52 +0900 |
commit | 5842f4e35c2d3c9df52301359e2888850f988c9d (patch) | |
tree | f47c8128e25bd3bfa56d33bd2df392a35d1c2665 | |
parent | c0fb88a15c02fc1be13605e08e38c818cd0d0bdf (diff) | |
download | curl-5842f4e35c2d3c9df52301359e2888850f988c9d.tar.gz curl-5842f4e35c2d3c9df52301359e2888850f988c9d.tar.bz2 curl-5842f4e35c2d3c9df52301359e2888850f988c9d.zip |
openssl: fix bad memory free (regression)submit/tizen_3.0_wearable/20161015.000001submit/tizen_3.0_tv/20161015.000001submit/tizen_3.0_mobile/20161015.000001submit/tizen_3.0_ivi/20161010.000001submit/tizen/20161004.080743accepted/tizen/wearable/20161005.080258accepted/tizen/tv/20161005.080243accepted/tizen/mobile/20161005.080228accepted/tizen/ivi/20161005.080315accepted/tizen/common/20161004.194334accepted/tizen/3.0/wearable/20161015.081908accepted/tizen/3.0/tv/20161016.004006accepted/tizen/3.0/mobile/20161015.032650accepted/tizen/3.0/ivi/20161011.043815
The allocation could be made by OpenSSL so the free must be made with OPENSSL_free() to avoid problems.
(https://github.com/curl/curl/issues/1005)
Change-Id: I07527924fe20ed859cbd5d7ade356410c64d71c7
Signed-off-by: Seonah Moon <seonah1.moon@samsung.com>
-rw-r--r-- | lib/vtls/openssl.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/vtls/openssl.c b/lib/vtls/openssl.c index 0a3e6a3be..0a46f9d43 100644 --- a/lib/vtls/openssl.c +++ b/lib/vtls/openssl.c @@ -1223,7 +1223,7 @@ static CURLcode verifyhost(struct connectdata *conn, X509 *server_cert) if(ASN1_STRING_type(tmp) == V_ASN1_UTF8STRING) { j = ASN1_STRING_length(tmp); if(j >= 0) { - peer_CN = malloc(j+1); + peer_CN = OPENSSL_malloc(j+1); if(peer_CN) { memcpy(peer_CN, ASN1_STRING_get0_data(tmp), j); peer_CN[j] = '\0'; @@ -1249,7 +1249,7 @@ static CURLcode verifyhost(struct connectdata *conn, X509 *server_cert) CURLcode rc = Curl_convert_from_utf8(data, peer_CN, strlen(peer_CN)); /* Curl_convert_from_utf8 calls failf if unsuccessful */ if(rc) { - free(peer_CN); + OPENSSL_free(peer_CN); return rc; } } @@ -1271,7 +1271,7 @@ static CURLcode verifyhost(struct connectdata *conn, X509 *server_cert) infof(data, " common name: %s (matched)\n", peer_CN); } if(peer_CN) - free(peer_CN); + OPENSSL_free(peer_CN); } return result; |