From: deraadt Date: Fri, 18 Apr 2014 15:38:16 +0000 (+0000) Subject: use the portable construct around asprintf; pointed out by halex X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=e19626267f2a403a068de8085f2052e1c259da5f;p=openbsd use the portable construct around asprintf; pointed out by halex --- 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; }