summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authortb <>2026-04-16 07:33:11 +0000
committertb <>2026-04-16 07:33:11 +0000
commit8dfa678933bc42faeff1d9406e589c16fac7f60e (patch)
tree26094a2de5bf6edd2be802d4410187f8361d2505 /src/lib
parent03c4722ecfb4116b7f9fd10b6a216287a7ecf24d (diff)
downloadopenbsd-8dfa678933bc42faeff1d9406e589c16fac7f60e.tar.gz
openbsd-8dfa678933bc42faeff1d9406e589c16fac7f60e.tar.bz2
openbsd-8dfa678933bc42faeff1d9406e589c16fac7f60e.zip
libtls: use TLS_ERROR_OUT_OF_MEMORY after malloc failure
tls_config_load_file() hat a spot that used TLS_ERROR_UNKNOWN, so switch that to the usual error code. Use tls_error_setx() since strerror(ENOMEM) adds nothing. From Michael Forney ok bcook
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/libtls/tls_config.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/lib/libtls/tls_config.c b/src/lib/libtls/tls_config.c
index 848117a91a..d35c5065c5 100644
--- a/src/lib/libtls/tls_config.c
+++ b/src/lib/libtls/tls_config.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: tls_config.c,v 1.72 2026/03/10 05:26:04 deraadt Exp $ */ 1/* $OpenBSD: tls_config.c,v 1.73 2026/04/16 07:33:11 tb Exp $ */
2/* 2/*
3 * Copyright (c) 2014 Joel Sing <jsing@openbsd.org> 3 * Copyright (c) 2014 Joel Sing <jsing@openbsd.org>
4 * 4 *
@@ -65,7 +65,7 @@ tls_config_load_file(struct tls_error *error, const char *filetype,
65 goto err; 65 goto err;
66 *len = (size_t)st.st_size; 66 *len = (size_t)st.st_size;
67 if ((*buf = malloc(*len)) == NULL) { 67 if ((*buf = malloc(*len)) == NULL) {
68 tls_error_set(error, TLS_ERROR_UNKNOWN, 68 tls_error_setx(error, TLS_ERROR_OUT_OF_MEMORY,
69 "failed to allocate buffer for %s file", 69 "failed to allocate buffer for %s file",
70 filetype); 70 filetype);
71 goto err; 71 goto err;