解决Golang(WINDOWS平台)调用openssl X509_STORE_load_locations函数时无法传递NULL指针导致该函数返回失败。

PS:Linux平台无此问题。
This commit is contained in:
zs
2016-08-17 13:45:11 +08:00
parent 76cab38a5f
commit fab3088721

View File

@@ -86,6 +86,13 @@ int X509_STORE_load_locations(X509_STORE *ctx, const char *file,
const char *path)
{
X509_LOOKUP *lookup;
//Support Go:
//Go调用此函数无法传递NULL指针,只能传递空串。
if (file && *file == '\0')
file = NULL;
if (path && *path == '\0')
path = NULL
if (file != NULL) {
lookup = X509_STORE_add_lookup(ctx, X509_LOOKUP_file());