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 17:52:08 +0000 (19:52 +0200)
Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
crypto/conf/conf_def.c

index b490377..1da68f9 100644 (file)
@@ -223,12 +223,11 @@ static int def_load_bio(CONF *conf, BIO *in, long *line)
         goto err;
     }
 
-    section = 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);