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 b4903772e35241f089aa00bb0ea8b50ad9f0a6de..1da68f93344a1ab4cc82c8d46049128821a792f0 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);