aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/security/security_context.c
diff options
context:
space:
mode:
authorGravatar Julien Boeuf <jboeuf@google.com>2015-04-15 15:52:23 -0700
committerGravatar Julien Boeuf <jboeuf@google.com>2015-04-15 15:56:38 -0700
commit28d75d934958d5bb33422c9ffec1820ff4dca812 (patch)
treed3f9fbc276efb264ab923e91f3f003f379ae5d77 /src/core/security/security_context.c
parent0afc3addf4b438d32ab9a7424c0ae588a1c8e212 (diff)
Adding option to add a null terminator when loading a file.
- This will take care of a potential issue with default credentials where the slice pointer is casted as const char * for APIs that need a null terminated string.
Diffstat (limited to 'src/core/security/security_context.c')
-rw-r--r--src/core/security/security_context.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/core/security/security_context.c b/src/core/security/security_context.c
index 08137803a3..dbfcf55655 100644
--- a/src/core/security/security_context.c
+++ b/src/core/security/security_context.c
@@ -359,7 +359,6 @@ static int ssl_host_matches_name(const tsi_peer *peer,
peer_name = allocated_name;
if (!peer_name) return 0;
}
-
r = tsi_ssl_peer_matches_name(peer, peer_name);
gpr_free(allocated_name);
return r;
@@ -453,13 +452,13 @@ static void init_default_pem_root_certs(void) {
if (default_root_certs_path == NULL) {
default_pem_root_certs = gpr_empty_slice();
} else {
- default_pem_root_certs = gpr_load_file(default_root_certs_path, NULL);
+ default_pem_root_certs = gpr_load_file(default_root_certs_path, 0, NULL);
gpr_free(default_root_certs_path);
}
/* Fall back to installed certs if needed. */
if (GPR_SLICE_IS_EMPTY(default_pem_root_certs)) {
- default_pem_root_certs = gpr_load_file(installed_roots_path, NULL);
+ default_pem_root_certs = gpr_load_file(installed_roots_path, 0, NULL);
}
}