Use asprintf() for generating path, instead of multiple
authorderaadt <deraadt@openbsd.org>
Fri, 18 Apr 2014 13:41:20 +0000 (13:41 +0000)
committerderaadt <deraadt@openbsd.org>
Fri, 18 Apr 2014 13:41:20 +0000 (13:41 +0000)
return-value-not-checked strlcpy and strlcat

lib/libssl/src/apps/apps.c

index c0130d4..cb9f8b0 100644 (file)
@@ -1324,15 +1324,9 @@ char *
 make_config_name()
 {
        const char *t = X509_get_default_cert_area();
-       size_t len;
        char *p;
 
-       len = strlen(t) + strlen(OPENSSL_CONF) + 2;
-       p = malloc(len);
-       BUF_strlcpy(p, t, len);
-       BUF_strlcat(p, "/", len);
-       BUF_strlcat(p, OPENSSL_CONF, len);
-
+       asprintf(&p, "%s/openssl.cnf", t);
        return p;
 }