Skip to content

Commit 51d3f96

Browse files
authored
Merge pull request #872 from openziti/avoid-crash-with-keychain-key
fix: handle unsupported keychain configuration
2 parents 8bf7cb5 + 0e80348 commit 51d3f96

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

library/utils.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -561,6 +561,10 @@ int load_key_internal(tls_context *tls, tlsuv_private_key_t *key, const char *ke
561561
}
562562

563563
if (strncmp(keystr, "keychain:", strlen("keychain:")) == 0) {
564+
if (tls->load_keychain_key == NULL) {
565+
ZITI_LOG(ERROR, "keychain is not supported and config appears to be copied from a system that supports it");
566+
return ZITI_INVALID_CONFIG;
567+
}
564568
const char *keyname = strchr(keystr, ':') + 1;
565569
rc = tls->load_keychain_key(key, keyname);
566570
if (rc != 0) {
@@ -684,4 +688,4 @@ uint64_t next_backoff(int *count, int max, uint64_t base) {
684688

685689
*count = c;
686690
return random % ((1U << backoff) * base);
687-
}
691+
}

0 commit comments

Comments
 (0)