summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authortb <>2025-03-07 10:54:51 +0000
committertb <>2025-03-07 10:54:51 +0000
commit41c00d0a9c6dadd73a0b529b8b28a4205e18870f (patch)
tree1d23788915093a80a4f62ca6d9fc5fc153640d6f /src
parentb026f03b39b5980cba929d4eb610326fc793e8db (diff)
downloadopenbsd-41c00d0a9c6dadd73a0b529b8b28a4205e18870f.tar.gz
openbsd-41c00d0a9c6dadd73a0b529b8b28a4205e18870f.tar.bz2
openbsd-41c00d0a9c6dadd73a0b529b8b28a4205e18870f.zip
_CONF_new_section(): replace hand-rolled strdup() with the real thing
ok jsing
Diffstat (limited to 'src')
-rw-r--r--src/lib/libcrypto/conf/conf_api.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/src/lib/libcrypto/conf/conf_api.c b/src/lib/libcrypto/conf/conf_api.c
index 25d2ef012e..b0056bcbe6 100644
--- a/src/lib/libcrypto/conf/conf_api.c
+++ b/src/lib/libcrypto/conf/conf_api.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: conf_api.c,v 1.22 2025/03/07 10:51:47 tb Exp $ */ 1/* $OpenBSD: conf_api.c,v 1.23 2025/03/07 10:54:51 tb Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -247,17 +247,15 @@ CONF_VALUE *
247_CONF_new_section(CONF *conf, const char *section) 247_CONF_new_section(CONF *conf, const char *section)
248{ 248{
249 STACK_OF(CONF_VALUE) *sk = NULL; 249 STACK_OF(CONF_VALUE) *sk = NULL;
250 int ok = 0, i; 250 int ok = 0;
251 CONF_VALUE *v = NULL, *vv; 251 CONF_VALUE *v = NULL, *vv;
252 252
253 if ((sk = sk_CONF_VALUE_new_null()) == NULL) 253 if ((sk = sk_CONF_VALUE_new_null()) == NULL)
254 goto err; 254 goto err;
255 if ((v = calloc(1, sizeof(*v))) == NULL) 255 if ((v = calloc(1, sizeof(*v))) == NULL)
256 goto err; 256 goto err;
257 i = strlen(section) + 1; 257 if ((v->section = strdup(section)) == NULL)
258 if ((v->section = malloc(i)) == NULL)
259 goto err; 258 goto err;
260 memcpy(v->section, section, i);
261 v->value = (char *)sk; 259 v->value = (char *)sk;
262 260
263 vv = lh_CONF_VALUE_insert(conf->data, v); 261 vv = lh_CONF_VALUE_insert(conf->data, v);