Browse code

tls: test the pointer to CA file path when setting the client property

Daniel-Constantin Mierla authored on 23/03/2021 11:53:38
Showing 1 changed files
... ...
@@ -580,9 +580,9 @@ static int load_ca_list(tls_domain_t* d)
580 580
 		DBG("%s: No CA list configured\n", tls_domain_str(d));
581 581
 		return 0;
582 582
 	}
583
-	if (d->ca_file.len>0 && fix_shm_pathname(&d->ca_file) < 0)
583
+	if (d->ca_file.s && d->ca_file.len>0 && fix_shm_pathname(&d->ca_file) < 0)
584 584
 		return -1;
585
-	if (d->ca_path.len>0 && fix_shm_pathname(&d->ca_path) < 0)
585
+	if (d->ca_path.s && d->ca_path.len>0 && fix_shm_pathname(&d->ca_path) < 0)
586 586
 		return -1;
587 587
 	procs_no=get_max_procs();
588 588
 	for(i = 0; i < procs_no; i++) {
... ...
@@ -594,7 +594,7 @@ static int load_ca_list(tls_domain_t* d)
594 594
 			TLS_ERR("load_ca_list:");
595 595
 			return -1;
596 596
 		}
597
-		if(d->ca_file.len>0) {
597
+		if(d->ca_file.s && d->ca_file.len>0) {
598 598
 			SSL_CTX_set_client_CA_list(d->ctx[i],
599 599
 					SSL_load_client_CA_file(d->ca_file.s));
600 600
 			if (SSL_CTX_get_client_CA_list(d->ctx[i]) == 0) {