summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorlteo <lteo@openbsd.org>2014-04-18 18:08:36 +0000
committerlteo <lteo@openbsd.org>2014-04-18 18:08:36 +0000
commitc7e9642196d6e0737e62873a1b6e88861d5a243c (patch)
tree6ba4232c70ec76a9eb7cbe517226636e89e3e274
parentfirst round of static config. ok miod (diff)
downloadwireguard-openbsd-c7e9642196d6e0737e62873a1b6e88861d5a243c.tar.xz
wireguard-openbsd-c7e9642196d6e0737e62873a1b6e88861d5a243c.zip
Use the cleaned up asprintf-based make_config_name() to make the name of
the config file instead of the malloc/BUF_strlcpy/BUF_strlcat calls with no return value checks (that make_config_name() also used to do prior to being cleaned up). ok beck@
-rw-r--r--lib/libssl/src/apps/ca.c13
-rw-r--r--lib/libssl/src/apps/srp.c13
2 files changed, 8 insertions, 18 deletions
diff --git a/lib/libssl/src/apps/ca.c b/lib/libssl/src/apps/ca.c
index f7b73189de0..1d750187324 100644
--- a/lib/libssl/src/apps/ca.c
+++ b/lib/libssl/src/apps/ca.c
@@ -91,7 +91,6 @@
#define BASE_SECTION "ca"
-#define CONFIG_FILE "openssl.cnf"
#define ENV_DEFAULT_CA "default_ca"
@@ -539,14 +538,10 @@ ca_main(int argc, char **argv)
if (configfile == NULL)
configfile = getenv("SSLEAY_CONF");
if (configfile == NULL) {
- const char *s = X509_get_default_cert_area();
- size_t len;
-
- len = strlen(s) + sizeof(CONFIG_FILE) + 1;
- tofree = malloc(len);
- BUF_strlcpy(tofree, s, len);
- BUF_strlcat(tofree, "/", len);
- BUF_strlcat(tofree, CONFIG_FILE, len);
+ if ((tofree = make_config_name()) == NULL) {
+ BIO_printf(bio_err, "error making config file name\n");
+ goto err;
+ }
configfile = tofree;
}
BIO_printf(bio_err, "Using configuration from %s\n", configfile);
diff --git a/lib/libssl/src/apps/srp.c b/lib/libssl/src/apps/srp.c
index a7bdcef0c99..bdd3017251d 100644
--- a/lib/libssl/src/apps/srp.c
+++ b/lib/libssl/src/apps/srp.c
@@ -72,7 +72,6 @@
#define BASE_SECTION "srp"
-#define CONFIG_FILE "openssl.cnf"
#define ENV_RANDFILE "RANDFILE"
@@ -413,14 +412,10 @@ srp_main(int argc, char **argv)
if (configfile == NULL)
configfile = getenv("SSLEAY_CONF");
if (configfile == NULL) {
- const char *s = X509_get_default_cert_area();
- size_t len;
-
- len = strlen(s) + sizeof(CONFIG_FILE) + 1;
- tofree = malloc(len);
- BUF_strlcpy(tofree, s, len);
- BUF_strlcat(tofree, "/", len);
- BUF_strlcat(tofree, CONFIG_FILE, len);
+ if ((tofree = make_config_name()) == NULL) {
+ BIO_printf(bio_err, "error making config file name\n");
+ goto err;
+ }
configfile = tofree;
}
VERBOSE BIO_printf(bio_err, "Using configuration from %s\n", configfile);