summary refs log tree commit diff
path: root/tls_config.c
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2026-06-01 14:50:25 -0400
committerJune McEnroe <june@causal.agency>2026-06-01 14:50:25 -0400
commit8a5bd6dcd6f7780354ed2e297edfddfec0273253 (patch)
treed6a47d1f9ce63cf523a845f426d0b879bc008eda /tls_config.c
parentImport LibreSSL 4.2.1 (diff)
downloadlibretls-8a5bd6dcd6f7780354ed2e297edfddfec0273253.tar.gz
libretls-8a5bd6dcd6f7780354ed2e297edfddfec0273253.zip
Import LibreSSL 4.3.0
Diffstat (limited to 'tls_config.c')
-rw-r--r--tls_config.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/tls_config.c b/tls_config.c
index 5774d40..76421bf 100644
--- a/tls_config.c
+++ b/tls_config.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tls_config.c,v 1.71 2024/08/02 15:00:01 tb Exp $ */
+/* $OpenBSD: tls_config.c,v 1.73 2026/04/16 07:33:11 tb Exp $ */
 /*
  * Copyright (c) 2014 Joel Sing <jsing@openbsd.org>
  *
@@ -49,7 +49,7 @@ tls_config_load_file(struct tls_error *error, const char *filetype,
 	*buf = NULL;
 	*len = 0;
 
-	if ((fd = open(filename, O_RDONLY)) == -1) {
+	if ((fd = open(filename, O_RDONLY|O_CLOEXEC)) == -1) {
 		tls_error_set(error, TLS_ERROR_UNKNOWN,
 		    "failed to open %s file '%s'",
 		    filetype, filename);
@@ -65,7 +65,7 @@ tls_config_load_file(struct tls_error *error, const char *filetype,
 		goto err;
 	*len = (size_t)st.st_size;
 	if ((*buf = malloc(*len)) == NULL) {
-		tls_error_set(error, TLS_ERROR_UNKNOWN,
+		tls_error_setx(error, TLS_ERROR_OUT_OF_MEMORY,
 		    "failed to allocate buffer for %s file",
 		    filetype);
 		goto err;