From a5a50915754e1a4190e23248c37127d8a27986e8 Mon Sep 17 00:00:00 2001 From: deraadt Date: Thu, 30 Apr 2015 15:28:03 +0000 Subject: [PATCH] use strdup() to init string ok doug millert --- lib/libcrypto/conf/conf_def.c | 5 ++--- lib/libssl/src/crypto/conf/conf_def.c | 5 ++--- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/lib/libcrypto/conf/conf_def.c b/lib/libcrypto/conf/conf_def.c index e608e5fe9d9..5526fa5c039 100644 --- a/lib/libcrypto/conf/conf_def.c +++ b/lib/libcrypto/conf/conf_def.c @@ -1,4 +1,4 @@ -/* $OpenBSD: conf_def.c,v 1.29 2015/02/07 13:19:15 doug Exp $ */ +/* $OpenBSD: conf_def.c,v 1.30 2015/04/30 15:28:03 deraadt Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -228,12 +228,11 @@ def_load_bio(CONF *conf, BIO *in, long *line) goto err; } - section = malloc(10); + section = strdup("default"); if (section == NULL) { CONFerr(CONF_F_DEF_LOAD_BIO, ERR_R_MALLOC_FAILURE); goto err; } - strlcpy(section, "default",10); if (_CONF_new_data(conf) == 0) { CONFerr(CONF_F_DEF_LOAD_BIO, ERR_R_MALLOC_FAILURE); diff --git a/lib/libssl/src/crypto/conf/conf_def.c b/lib/libssl/src/crypto/conf/conf_def.c index e608e5fe9d9..5526fa5c039 100644 --- a/lib/libssl/src/crypto/conf/conf_def.c +++ b/lib/libssl/src/crypto/conf/conf_def.c @@ -1,4 +1,4 @@ -/* $OpenBSD: conf_def.c,v 1.29 2015/02/07 13:19:15 doug Exp $ */ +/* $OpenBSD: conf_def.c,v 1.30 2015/04/30 15:28:03 deraadt Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -228,12 +228,11 @@ def_load_bio(CONF *conf, BIO *in, long *line) goto err; } - section = malloc(10); + section = strdup("default"); if (section == NULL) { CONFerr(CONF_F_DEF_LOAD_BIO, ERR_R_MALLOC_FAILURE); goto err; } - strlcpy(section, "default",10); if (_CONF_new_data(conf) == 0) { CONFerr(CONF_F_DEF_LOAD_BIO, ERR_R_MALLOC_FAILURE); -- 2.20.1