From e19626267f2a403a068de8085f2052e1c259da5f Mon Sep 17 00:00:00 2001 From: deraadt Date: Fri, 18 Apr 2014 15:38:16 +0000 Subject: [PATCH] use the portable construct around asprintf; pointed out by halex --- lib/libcrypto/conf/conf_mod.c | 3 ++- lib/libssl/src/apps/apps.c | 3 ++- lib/libssl/src/crypto/conf/conf_mod.c | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/lib/libcrypto/conf/conf_mod.c b/lib/libcrypto/conf/conf_mod.c index 436f239b12e..24170865378 100644 --- a/lib/libcrypto/conf/conf_mod.c +++ b/lib/libcrypto/conf/conf_mod.c @@ -551,7 +551,8 @@ CONF_get1_default_config_file(void) file = getenv("OPENSSL_CONF"); if (file) return BUF_strdup(file); - asprintf(&file, "%s/openssl.cnf", X509_get_default_cert_area()); + if (asprintf(&file, "%s/openssl.cnf", X509_get_default_cert_area()) == -1) + return (NULL); return file; } diff --git a/lib/libssl/src/apps/apps.c b/lib/libssl/src/apps/apps.c index cb9f8b0058e..446bb4d17ce 100644 --- a/lib/libssl/src/apps/apps.c +++ b/lib/libssl/src/apps/apps.c @@ -1326,7 +1326,8 @@ make_config_name() const char *t = X509_get_default_cert_area(); char *p; - asprintf(&p, "%s/openssl.cnf", t); + if (asprintf(&p, "%s/openssl.cnf", t) == -1) + return NULL; return p; } diff --git a/lib/libssl/src/crypto/conf/conf_mod.c b/lib/libssl/src/crypto/conf/conf_mod.c index 436f239b12e..24170865378 100644 --- a/lib/libssl/src/crypto/conf/conf_mod.c +++ b/lib/libssl/src/crypto/conf/conf_mod.c @@ -551,7 +551,8 @@ CONF_get1_default_config_file(void) file = getenv("OPENSSL_CONF"); if (file) return BUF_strdup(file); - asprintf(&file, "%s/openssl.cnf", X509_get_default_cert_area()); + if (asprintf(&file, "%s/openssl.cnf", X509_get_default_cert_area()) == -1) + return (NULL); return file; } -- 2.20.1