Replace malloc+strlcpy with strdup
authorAlessandro Ghedini <alessandro@ghedini.me>
Thu, 8 Oct 2015 12:37:21 +0000 (14:37 +0200)
committerRichard Levitte <levitte@openssl.org>
Fri, 23 Oct 2015 18:38:47 +0000 (20:38 +0200)
Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
(cherry picked from commit 8acaabec429b39f9436f6a88006384d72d292539)

crypto/conf/conf_def.c

index faca9aeb571b9dc9cb208415a0c24e3bac89015c..68c77cec7d8b4605e3d0afb6044a1ea2ab426a09 100644 (file)
@@ -225,12 +225,11 @@ static int def_load_bio(CONF *conf, BIO *in, long *line)
         goto err;
     }
 
-    section = (char *)OPENSSL_malloc(10);
+    section = BUF_strdup("default");
     if (section == NULL) {
         CONFerr(CONF_F_DEF_LOAD_BIO, ERR_R_MALLOC_FAILURE);
         goto err;
     }
-    BUF_strlcpy(section, "default", 10);
 
     if (_CONF_new_data(conf) == 0) {
         CONFerr(CONF_F_DEF_LOAD_BIO, ERR_R_MALLOC_FAILURE);