-/* $OpenBSD: ameth_lib.c,v 1.13 2014/07/11 13:41:59 miod Exp $ */
+/* $OpenBSD: ameth_lib.c,v 1.14 2014/07/13 16:03:09 beck Exp $ */
/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
* project 2006.
*/
ameth->pkey_flags = flags | ASN1_PKEY_DYNAMIC;
if (info) {
- ameth->info = BUF_strdup(info);
+ ameth->info = strdup(info);
if (!ameth->info)
goto err;
} else
ameth->info = NULL;
if (pem_str) {
- ameth->pem_str = BUF_strdup(pem_str);
+ ameth->pem_str = strdup(pem_str);
if (!ameth->pem_str)
goto err;
} else
-/* $OpenBSD: asn_mime.c,v 1.21 2014/07/11 13:41:59 miod Exp $ */
+/* $OpenBSD: asn_mime.c,v 1.22 2014/07/13 16:03:09 beck Exp $ */
/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
* project.
*/
char *tmpname = NULL, *tmpval = NULL, *p;
if (name) {
- if (!(tmpname = BUF_strdup(name)))
+ if (!(tmpname = strdup(name)))
goto err;
for (p = tmpname; *p; p++)
*p = tolower((unsigned char)*p);
}
if (value) {
- if (!(tmpval = BUF_strdup(value)))
+ if (!(tmpval = strdup(value)))
goto err;
for (p = tmpval; *p; p++)
*p = tolower((unsigned char)*p);
MIME_PARAM *mparam;
if (name) {
- tmpname = BUF_strdup(name);
+ tmpname = strdup(name);
if (!tmpname)
goto err;
for (p = tmpname; *p; p++)
*p = tolower((unsigned char)*p);
}
if (value) {
- tmpval = BUF_strdup(value);
+ tmpval = strdup(value);
if (!tmpval)
goto err;
}
-/* $OpenBSD: b_sock.c,v 1.54 2014/07/11 08:44:47 jsing Exp $ */
+/* $OpenBSD: b_sock.c,v 1.55 2014/07/13 16:03:09 beck Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
unsigned long l;
int err_num;
- if ((str = BUF_strdup(host)) == NULL)
+ if (host == NULL || (str = strdup(host)) == NULL)
return (-1);
h = p = NULL;
-/* $OpenBSD: bss_acpt.c,v 1.23 2014/07/11 08:44:47 jsing Exp $ */
+/* $OpenBSD: bss_acpt.c,v 1.24 2014/07/13 16:03:09 beck Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
if (num == 0) {
b->init = 1;
free(data->param_addr);
- data->param_addr = BUF_strdup(ptr);
+ data->param_addr = strdup(ptr);
} else if (num == 1) {
data->accept_nbio = (ptr != NULL);
} else if (num == 2) {
-/* $OpenBSD: bss_conn.c,v 1.29 2014/07/11 08:44:47 jsing Exp $ */
+/* $OpenBSD: bss_conn.c,v 1.30 2014/07/13 16:03:09 beck Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
break;
}
free(c->param_port);
- c->param_port = BUF_strdup(p);
+ c->param_port = strdup(p);
}
}
b->init = 1;
if (num == 0) {
free(data->param_hostname);
- data->param_hostname = BUF_strdup(ptr);
+ data->param_hostname = strdup(ptr);
} else if (num == 1) {
free(data->param_port);
- data->param_port = BUF_strdup(ptr);
+ data->param_port = strdup(ptr);
} else if (num == 2) {
unsigned char *p = ptr;
free(data->param_hostname);
-/* $OpenBSD: conf_mod.c,v 1.23 2014/07/11 08:44:48 jsing Exp $ */
+/* $OpenBSD: conf_mod.c,v 1.24 2014/07/13 16:03:09 beck Exp $ */
/* Written by Stephen Henson (steve@openssl.org) for the OpenSSL
* project 2001.
*/
goto err;
imod->pmod = pmod;
- imod->name = BUF_strdup(name);
- imod->value = BUF_strdup(value);
+ imod->name = name ? strdup(name) : NULL;
+ imod->value = value ? strdup(value) : NULL;
imod->usr_data = NULL;
if (!imod->name || !imod->value)
if (issetugid() == 0)
file = getenv("OPENSSL_CONF");
if (file)
- return BUF_strdup(file);
+ return strdup(file);
if (asprintf(&file, "%s/openssl.cnf",
X509_get_default_cert_area()) == -1)
return (NULL);
-/* $OpenBSD: eng_dyn.c,v 1.11 2014/07/10 13:58:22 jsing Exp $ */
+/* $OpenBSD: eng_dyn.c,v 1.12 2014/07/13 16:03:09 beck Exp $ */
/* Written by Geoff Thorpe (geoff@geoffthorpe.net) for the OpenSSL
* project 2001.
*/
p = NULL;
free((void *)ctx->DYNAMIC_LIBNAME);
if (p)
- ctx->DYNAMIC_LIBNAME = BUF_strdup(p);
+ ctx->DYNAMIC_LIBNAME = strdup(p);
else
ctx->DYNAMIC_LIBNAME = NULL;
return (ctx->DYNAMIC_LIBNAME ? 1 : 0);
p = NULL;
free((void *)ctx->engine_id);
if (p)
- ctx->engine_id = BUF_strdup(p);
+ ctx->engine_id = strdup(p);
else
ctx->engine_id = NULL;
return (ctx->engine_id ? 1 : 0);
return 0;
}
{
- char *tmp_str = BUF_strdup(p);
+ char *tmp_str = strdup(p);
if (!tmp_str) {
ENGINEerr(ENGINE_F_DYNAMIC_CTRL,
ERR_R_MALLOC_FAILURE);
-/* $OpenBSD: ocsp_lib.c,v 1.14 2014/07/11 08:44:49 jsing Exp $ */
+/* $OpenBSD: ocsp_lib.c,v 1.15 2014/07/13 16:03:09 beck Exp $ */
/* Written by Tom Titchener <Tom_Titchener@groove.net> for the OpenSSL
* project. */
*ppath = NULL;
/* dup the buffer since we are going to mess with it */
- buf = BUF_strdup(url);
+ buf = url ? strdup(url) : NULL;
if (!buf)
goto mem_err;
/* Check for trailing part of path */
p = strchr(p, '/');
if (!p)
- *ppath = BUF_strdup("/");
+ *ppath = strdup("/");
else {
- *ppath = BUF_strdup(p);
+ *ppath = strdup(p);
/* Set start of path to 0 so hostname is valid */
*p = '\0';
}
port = "80";
}
- *pport = BUF_strdup(port);
+ *pport = strdup(port);
if (!*pport)
goto mem_err;
- *phost = BUF_strdup(host);
+ *phost = strdup(host);
if (!*phost)
goto mem_err;
-/* $OpenBSD: srp_vfy.c,v 1.7 2014/07/11 08:44:49 jsing Exp $ */
+/* $OpenBSD: srp_vfy.c,v 1.8 2014/07/13 16:03:10 beck Exp $ */
/* Written by Christophe Renou (christophe.renou@edelweb.fr) with
* the precious help of Peter Sylvester (peter.sylvester@edelweb.fr)
* for the EdelKey project and contributed to the OpenSSL project 2004.
static int SRP_user_pwd_set_ids(SRP_user_pwd *vinfo, const char *id,
const char *info)
{
- if (id != NULL && NULL == (vinfo->id = BUF_strdup(id)))
+ if (id != NULL && NULL == (vinfo->id = strdup(id)))
return 0;
- return (info == NULL || NULL != (vinfo->info = BUF_strdup(info))) ;
+ return (info == NULL || NULL != (vinfo->info = strdup(info))) ;
}
static int SRP_user_pwd_set_sv(SRP_user_pwd *vinfo, const char *s,
vb->default_N = NULL;
vb->seed_key = NULL;
if ((seed_key != NULL) &&
- (vb->seed_key = BUF_strdup(seed_key)) == NULL)
+ (vb->seed_key = strdup(seed_key)) == NULL)
{
sk_SRP_user_pwd_free(vb->users_pwd);
sk_SRP_gN_cache_free(vb->gN_cache);
-/* $OpenBSD: ui_lib.c,v 1.26 2014/07/11 16:22:29 deraadt Exp $ */
+/* $OpenBSD: ui_lib.c,v 1.27 2014/07/13 16:03:10 beck Exp $ */
/* Written by Richard Levitte (richard@levitte.org) for the OpenSSL
* project 2001.
*/
char *prompt_copy = NULL;
if (prompt) {
- prompt_copy = BUF_strdup(prompt);
+ prompt_copy = strdup(prompt);
if (prompt_copy == NULL) {
UIerr(UI_F_UI_DUP_INPUT_STRING, ERR_R_MALLOC_FAILURE);
return 0;
char *prompt_copy = NULL;
if (prompt) {
- prompt_copy = BUF_strdup(prompt);
+ prompt_copy = strdup(prompt);
if (prompt_copy == NULL) {
UIerr(UI_F_UI_DUP_VERIFY_STRING, ERR_R_MALLOC_FAILURE);
return -1;
char *cancel_chars_copy = NULL;
if (prompt) {
- prompt_copy = BUF_strdup(prompt);
+ prompt_copy = strdup(prompt);
if (prompt_copy == NULL) {
UIerr(UI_F_UI_DUP_INPUT_BOOLEAN, ERR_R_MALLOC_FAILURE);
goto err;
}
}
if (action_desc) {
- action_desc_copy = BUF_strdup(action_desc);
+ action_desc_copy = strdup(action_desc);
if (action_desc_copy == NULL) {
UIerr(UI_F_UI_DUP_INPUT_BOOLEAN, ERR_R_MALLOC_FAILURE);
goto err;
}
}
if (ok_chars) {
- ok_chars_copy = BUF_strdup(ok_chars);
+ ok_chars_copy = strdup(ok_chars);
if (ok_chars_copy == NULL) {
UIerr(UI_F_UI_DUP_INPUT_BOOLEAN, ERR_R_MALLOC_FAILURE);
goto err;
}
}
if (cancel_chars) {
- cancel_chars_copy = BUF_strdup(cancel_chars);
+ cancel_chars_copy = strdup(cancel_chars);
if (cancel_chars_copy == NULL) {
UIerr(UI_F_UI_DUP_INPUT_BOOLEAN, ERR_R_MALLOC_FAILURE);
goto err;
char *text_copy = NULL;
if (text) {
- text_copy = BUF_strdup(text);
+ text_copy = strdup(text);
if (text_copy == NULL) {
UIerr(UI_F_UI_DUP_INFO_STRING, ERR_R_MALLOC_FAILURE);
return -1;
char *text_copy = NULL;
if (text) {
- text_copy = BUF_strdup(text);
+ text_copy = strdup(text);
if (text_copy == NULL) {
UIerr(UI_F_UI_DUP_ERROR_STRING, ERR_R_MALLOC_FAILURE);
return -1;
-/* $OpenBSD: v3_addr.c,v 1.12 2014/07/11 08:44:49 jsing Exp $ */
+/* $OpenBSD: v3_addr.c,v 1.13 2014/07/13 16:03:10 beck Exp $ */
/*
* Contributed to the OpenSSL Project by the American Registry for
* Internet Numbers ("ARIN").
goto err;
}
t += strspn(t, " \t");
- s = BUF_strdup(t);
+ s = strdup(t);
} else {
- s = BUF_strdup(val->value);
+ s = strdup(val->value);
}
if (s == NULL) {
X509V3err(X509V3_F_V2I_IPADDRBLOCKS,
-/* $OpenBSD: v3_asid.c,v 1.10 2014/07/11 08:44:49 jsing Exp $ */
+/* $OpenBSD: v3_asid.c,v 1.11 2014/07/13 16:03:10 beck Exp $ */
/*
* Contributed to the OpenSSL Project by the American Registry for
* Internet Numbers ("ARIN").
goto err;
}
} else {
- char *s = BUF_strdup(val->value);
+ char *s = strdup(val->value);
if (s == NULL) {
X509V3err(X509V3_F_V2I_ASIDENTIFIERS,
ERR_R_MALLOC_FAILURE);
-/* $OpenBSD: v3_enum.c,v 1.9 2014/07/11 08:44:49 jsing Exp $ */
+/* $OpenBSD: v3_enum.c,v 1.10 2014/07/13 16:03:10 beck Exp $ */
/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
* project 1999.
*/
*/
#include <stdio.h>
-
+#include <string.h>
#include <openssl/x509v3.h>
static ENUMERATED_NAMES crl_reasons[] = {
strval = ASN1_ENUMERATED_get(e);
for (enam = method->usr_data; enam->lname; enam++) {
if (strval == enam->bitnum)
- return BUF_strdup(enam->lname);
+ return strdup(enam->lname);
}
return i2s_ASN1_ENUMERATED(method, e);
}
-/* $OpenBSD: v3_purp.c,v 1.21 2014/07/11 08:44:49 jsing Exp $ */
+/* $OpenBSD: v3_purp.c,v 1.22 2014/07/13 16:03:10 beck Exp $ */
/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
* project 2001.
*/
free(ptmp->sname);
}
/* dup supplied name */
- ptmp->name = BUF_strdup(name);
- ptmp->sname = BUF_strdup(sname);
+ ptmp->name = name ? strdup(name) : NULL;
+ ptmp->sname = sname ? strdup(sname) : NULL;
if (!ptmp->name || !ptmp->sname) {
free(ptmp->name);
free(ptmp->sname);
-/* $OpenBSD: v3_utl.c,v 1.22 2014/07/11 08:44:49 jsing Exp $ */
+/* $OpenBSD: v3_utl.c,v 1.23 2014/07/13 16:03:10 beck Exp $ */
/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
* project.
*/
CONF_VALUE *vtmp = NULL;
char *tname = NULL, *tvalue = NULL;
- if (name && !(tname = BUF_strdup(name)))
+ if (name && !(tname = strdup(name)))
goto err;
- if (value && !(tvalue = BUF_strdup(value)))
+ if (value && !(tvalue = strdup(value)))
goto err;
if (!(vtmp = malloc(sizeof(CONF_VALUE))))
goto err;
int state;
/* We are going to modify the line so copy it first */
- linebuf = BUF_strdup(line);
+ if ((linebuf = strdup(line)) == NULL) {
+ X509V3err(X509V3_F_X509V3_PARSE_LIST, ERR_R_MALLOC_FAILURE);
+ goto err;
+ }
state = HDR_NAME;
ntmp = NULL;
/* Don't add duplicates */
if (sk_OPENSSL_STRING_find(*sk, (char *)email->data) != -1)
return 1;
- emtmp = BUF_strdup((char *)email->data);
+ emtmp = strdup((char *)email->data);
if (!emtmp || !sk_OPENSSL_STRING_push(*sk, emtmp)) {
X509_email_free(*sk);
*sk = NULL;
p = strchr(ipasc, '/');
if (!p)
return NULL;
- iptmp = BUF_strdup(ipasc);
+ iptmp = strdup(ipasc);
if (!iptmp)
return NULL;
p = iptmp + (p - ipasc);
-/* $OpenBSD: s3_lib.c,v 1.70 2014/07/12 22:33:39 jsing Exp $ */
+/* $OpenBSD: s3_lib.c,v 1.71 2014/07/13 16:03:10 beck Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
SSL_R_SSL3_EXT_INVALID_SERVERNAME);
return 0;
}
- if ((s->tlsext_hostname = BUF_strdup((char *)parg))
+ if ((s->tlsext_hostname = strdup((char *)parg))
== NULL) {
SSLerr(SSL_F_SSL3_CTRL,
ERR_R_INTERNAL_ERROR);
-/* $OpenBSD: apps.c,v 1.65 2014/07/12 17:54:31 jsing Exp $ */
+/* $OpenBSD: apps.c,v 1.66 2014/07/13 16:03:09 beck Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
int i;
if (!strncmp(arg, "pass:", 5))
- return BUF_strdup(arg + 5);
+ return strdup(arg + 5);
if (!strncmp(arg, "env:", 4)) {
tmp = getenv(arg + 4);
if (!tmp) {
arg + 4);
return NULL;
}
- return BUF_strdup(tmp);
+ return strdup(tmp);
}
if (!keepbio || !pwdbio) {
if (!strncmp(arg, "file:", 5)) {
tmp = strchr(tpass, '\n');
if (tmp)
*tmp = 0;
- return BUF_strdup(tpass);
+ return strdup(tpass);
}
int
-/* $OpenBSD: ca.c,v 1.62 2014/07/12 17:54:31 jsing Exp $ */
+/* $OpenBSD: ca.c,v 1.63 2014/07/13 16:03:09 beck Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
}
if (BN_is_zero(serial))
- row[DB_serial] = BUF_strdup("00");
+ row[DB_serial] = strdup("00");
else
row[DB_serial] = BN_bn2hex(serial);
if (row[DB_serial] == NULL) {
if (!bn)
goto err;
if (BN_is_zero(bn))
- row[DB_serial] = BUF_strdup("00");
+ row[DB_serial] = strdup("00");
else
row[DB_serial] = BN_bn2hex(bn);
BN_free(bn);
ASN1_OBJECT *hold = NULL;
ASN1_GENERALIZEDTIME *comp_time = NULL;
- tmp = BUF_strdup(str);
+ if ((tmp = strdup(str)) == NULL) {
+ BIO_printf(bio_err, "malloc failed\n");
+ goto err;
+ }
p = strchr(tmp, ',');
rtime_str = tmp;
-/* $OpenBSD: cms.c,v 1.19 2014/07/12 17:54:31 jsing Exp $ */
+/* $OpenBSD: cms.c,v 1.20 2014/07/13 16:03:09 beck Exp $ */
/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
* project.
*/
secret_keyid = NULL;
}
if (pwri_pass) {
- pwri_tmp =
- (unsigned char *)BUF_strdup((char *)pwri_pass);
+ pwri_tmp = strdup(pwri_pass);
if (!pwri_tmp)
goto end;
if (!CMS_add0_recipient_password(cms, -1, NID_undef,
-/* $OpenBSD: ocsp.c,v 1.29 2014/07/12 19:31:21 jsing Exp $ */
+/* $OpenBSD: ocsp.c,v 1.30 2014/07/13 16:03:09 beck Exp $ */
/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
* project 2000.
*/
OPENSSL_assert(bn); /* FIXME: should report an error at this
* point and abort */
if (BN_is_zero(bn))
- itmp = BUF_strdup("00");
+ itmp = strdup("00");
else
itmp = BN_bn2hex(bn);
row[DB_serial] = itmp;
-/* $OpenBSD: ameth_lib.c,v 1.13 2014/07/11 13:41:59 miod Exp $ */
+/* $OpenBSD: ameth_lib.c,v 1.14 2014/07/13 16:03:09 beck Exp $ */
/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
* project 2006.
*/
ameth->pkey_flags = flags | ASN1_PKEY_DYNAMIC;
if (info) {
- ameth->info = BUF_strdup(info);
+ ameth->info = strdup(info);
if (!ameth->info)
goto err;
} else
ameth->info = NULL;
if (pem_str) {
- ameth->pem_str = BUF_strdup(pem_str);
+ ameth->pem_str = strdup(pem_str);
if (!ameth->pem_str)
goto err;
} else
-/* $OpenBSD: asn_mime.c,v 1.21 2014/07/11 13:41:59 miod Exp $ */
+/* $OpenBSD: asn_mime.c,v 1.22 2014/07/13 16:03:09 beck Exp $ */
/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
* project.
*/
char *tmpname = NULL, *tmpval = NULL, *p;
if (name) {
- if (!(tmpname = BUF_strdup(name)))
+ if (!(tmpname = strdup(name)))
goto err;
for (p = tmpname; *p; p++)
*p = tolower((unsigned char)*p);
}
if (value) {
- if (!(tmpval = BUF_strdup(value)))
+ if (!(tmpval = strdup(value)))
goto err;
for (p = tmpval; *p; p++)
*p = tolower((unsigned char)*p);
MIME_PARAM *mparam;
if (name) {
- tmpname = BUF_strdup(name);
+ tmpname = strdup(name);
if (!tmpname)
goto err;
for (p = tmpname; *p; p++)
*p = tolower((unsigned char)*p);
}
if (value) {
- tmpval = BUF_strdup(value);
+ tmpval = strdup(value);
if (!tmpval)
goto err;
}
-/* $OpenBSD: b_sock.c,v 1.54 2014/07/11 08:44:47 jsing Exp $ */
+/* $OpenBSD: b_sock.c,v 1.55 2014/07/13 16:03:09 beck Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
unsigned long l;
int err_num;
- if ((str = BUF_strdup(host)) == NULL)
+ if (host == NULL || (str = strdup(host)) == NULL)
return (-1);
h = p = NULL;
-/* $OpenBSD: bss_acpt.c,v 1.23 2014/07/11 08:44:47 jsing Exp $ */
+/* $OpenBSD: bss_acpt.c,v 1.24 2014/07/13 16:03:09 beck Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
if (num == 0) {
b->init = 1;
free(data->param_addr);
- data->param_addr = BUF_strdup(ptr);
+ data->param_addr = strdup(ptr);
} else if (num == 1) {
data->accept_nbio = (ptr != NULL);
} else if (num == 2) {
-/* $OpenBSD: bss_conn.c,v 1.29 2014/07/11 08:44:47 jsing Exp $ */
+/* $OpenBSD: bss_conn.c,v 1.30 2014/07/13 16:03:09 beck Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
break;
}
free(c->param_port);
- c->param_port = BUF_strdup(p);
+ c->param_port = strdup(p);
}
}
b->init = 1;
if (num == 0) {
free(data->param_hostname);
- data->param_hostname = BUF_strdup(ptr);
+ data->param_hostname = strdup(ptr);
} else if (num == 1) {
free(data->param_port);
- data->param_port = BUF_strdup(ptr);
+ data->param_port = strdup(ptr);
} else if (num == 2) {
unsigned char *p = ptr;
free(data->param_hostname);
-/* $OpenBSD: conf_mod.c,v 1.23 2014/07/11 08:44:48 jsing Exp $ */
+/* $OpenBSD: conf_mod.c,v 1.24 2014/07/13 16:03:09 beck Exp $ */
/* Written by Stephen Henson (steve@openssl.org) for the OpenSSL
* project 2001.
*/
goto err;
imod->pmod = pmod;
- imod->name = BUF_strdup(name);
- imod->value = BUF_strdup(value);
+ imod->name = name ? strdup(name) : NULL;
+ imod->value = value ? strdup(value) : NULL;
imod->usr_data = NULL;
if (!imod->name || !imod->value)
if (issetugid() == 0)
file = getenv("OPENSSL_CONF");
if (file)
- return BUF_strdup(file);
+ return strdup(file);
if (asprintf(&file, "%s/openssl.cnf",
X509_get_default_cert_area()) == -1)
return (NULL);
-/* $OpenBSD: eng_dyn.c,v 1.11 2014/07/10 13:58:22 jsing Exp $ */
+/* $OpenBSD: eng_dyn.c,v 1.12 2014/07/13 16:03:09 beck Exp $ */
/* Written by Geoff Thorpe (geoff@geoffthorpe.net) for the OpenSSL
* project 2001.
*/
p = NULL;
free((void *)ctx->DYNAMIC_LIBNAME);
if (p)
- ctx->DYNAMIC_LIBNAME = BUF_strdup(p);
+ ctx->DYNAMIC_LIBNAME = strdup(p);
else
ctx->DYNAMIC_LIBNAME = NULL;
return (ctx->DYNAMIC_LIBNAME ? 1 : 0);
p = NULL;
free((void *)ctx->engine_id);
if (p)
- ctx->engine_id = BUF_strdup(p);
+ ctx->engine_id = strdup(p);
else
ctx->engine_id = NULL;
return (ctx->engine_id ? 1 : 0);
return 0;
}
{
- char *tmp_str = BUF_strdup(p);
+ char *tmp_str = strdup(p);
if (!tmp_str) {
ENGINEerr(ENGINE_F_DYNAMIC_CTRL,
ERR_R_MALLOC_FAILURE);
-/* $OpenBSD: ocsp_lib.c,v 1.14 2014/07/11 08:44:49 jsing Exp $ */
+/* $OpenBSD: ocsp_lib.c,v 1.15 2014/07/13 16:03:09 beck Exp $ */
/* Written by Tom Titchener <Tom_Titchener@groove.net> for the OpenSSL
* project. */
*ppath = NULL;
/* dup the buffer since we are going to mess with it */
- buf = BUF_strdup(url);
+ buf = url ? strdup(url) : NULL;
if (!buf)
goto mem_err;
/* Check for trailing part of path */
p = strchr(p, '/');
if (!p)
- *ppath = BUF_strdup("/");
+ *ppath = strdup("/");
else {
- *ppath = BUF_strdup(p);
+ *ppath = strdup(p);
/* Set start of path to 0 so hostname is valid */
*p = '\0';
}
port = "80";
}
- *pport = BUF_strdup(port);
+ *pport = strdup(port);
if (!*pport)
goto mem_err;
- *phost = BUF_strdup(host);
+ *phost = strdup(host);
if (!*phost)
goto mem_err;
-/* $OpenBSD: srp_vfy.c,v 1.7 2014/07/11 08:44:49 jsing Exp $ */
+/* $OpenBSD: srp_vfy.c,v 1.8 2014/07/13 16:03:10 beck Exp $ */
/* Written by Christophe Renou (christophe.renou@edelweb.fr) with
* the precious help of Peter Sylvester (peter.sylvester@edelweb.fr)
* for the EdelKey project and contributed to the OpenSSL project 2004.
static int SRP_user_pwd_set_ids(SRP_user_pwd *vinfo, const char *id,
const char *info)
{
- if (id != NULL && NULL == (vinfo->id = BUF_strdup(id)))
+ if (id != NULL && NULL == (vinfo->id = strdup(id)))
return 0;
- return (info == NULL || NULL != (vinfo->info = BUF_strdup(info))) ;
+ return (info == NULL || NULL != (vinfo->info = strdup(info))) ;
}
static int SRP_user_pwd_set_sv(SRP_user_pwd *vinfo, const char *s,
vb->default_N = NULL;
vb->seed_key = NULL;
if ((seed_key != NULL) &&
- (vb->seed_key = BUF_strdup(seed_key)) == NULL)
+ (vb->seed_key = strdup(seed_key)) == NULL)
{
sk_SRP_user_pwd_free(vb->users_pwd);
sk_SRP_gN_cache_free(vb->gN_cache);
-/* $OpenBSD: ui_lib.c,v 1.26 2014/07/11 16:22:29 deraadt Exp $ */
+/* $OpenBSD: ui_lib.c,v 1.27 2014/07/13 16:03:10 beck Exp $ */
/* Written by Richard Levitte (richard@levitte.org) for the OpenSSL
* project 2001.
*/
char *prompt_copy = NULL;
if (prompt) {
- prompt_copy = BUF_strdup(prompt);
+ prompt_copy = strdup(prompt);
if (prompt_copy == NULL) {
UIerr(UI_F_UI_DUP_INPUT_STRING, ERR_R_MALLOC_FAILURE);
return 0;
char *prompt_copy = NULL;
if (prompt) {
- prompt_copy = BUF_strdup(prompt);
+ prompt_copy = strdup(prompt);
if (prompt_copy == NULL) {
UIerr(UI_F_UI_DUP_VERIFY_STRING, ERR_R_MALLOC_FAILURE);
return -1;
char *cancel_chars_copy = NULL;
if (prompt) {
- prompt_copy = BUF_strdup(prompt);
+ prompt_copy = strdup(prompt);
if (prompt_copy == NULL) {
UIerr(UI_F_UI_DUP_INPUT_BOOLEAN, ERR_R_MALLOC_FAILURE);
goto err;
}
}
if (action_desc) {
- action_desc_copy = BUF_strdup(action_desc);
+ action_desc_copy = strdup(action_desc);
if (action_desc_copy == NULL) {
UIerr(UI_F_UI_DUP_INPUT_BOOLEAN, ERR_R_MALLOC_FAILURE);
goto err;
}
}
if (ok_chars) {
- ok_chars_copy = BUF_strdup(ok_chars);
+ ok_chars_copy = strdup(ok_chars);
if (ok_chars_copy == NULL) {
UIerr(UI_F_UI_DUP_INPUT_BOOLEAN, ERR_R_MALLOC_FAILURE);
goto err;
}
}
if (cancel_chars) {
- cancel_chars_copy = BUF_strdup(cancel_chars);
+ cancel_chars_copy = strdup(cancel_chars);
if (cancel_chars_copy == NULL) {
UIerr(UI_F_UI_DUP_INPUT_BOOLEAN, ERR_R_MALLOC_FAILURE);
goto err;
char *text_copy = NULL;
if (text) {
- text_copy = BUF_strdup(text);
+ text_copy = strdup(text);
if (text_copy == NULL) {
UIerr(UI_F_UI_DUP_INFO_STRING, ERR_R_MALLOC_FAILURE);
return -1;
char *text_copy = NULL;
if (text) {
- text_copy = BUF_strdup(text);
+ text_copy = strdup(text);
if (text_copy == NULL) {
UIerr(UI_F_UI_DUP_ERROR_STRING, ERR_R_MALLOC_FAILURE);
return -1;
-/* $OpenBSD: v3_addr.c,v 1.12 2014/07/11 08:44:49 jsing Exp $ */
+/* $OpenBSD: v3_addr.c,v 1.13 2014/07/13 16:03:10 beck Exp $ */
/*
* Contributed to the OpenSSL Project by the American Registry for
* Internet Numbers ("ARIN").
goto err;
}
t += strspn(t, " \t");
- s = BUF_strdup(t);
+ s = strdup(t);
} else {
- s = BUF_strdup(val->value);
+ s = strdup(val->value);
}
if (s == NULL) {
X509V3err(X509V3_F_V2I_IPADDRBLOCKS,
-/* $OpenBSD: v3_asid.c,v 1.10 2014/07/11 08:44:49 jsing Exp $ */
+/* $OpenBSD: v3_asid.c,v 1.11 2014/07/13 16:03:10 beck Exp $ */
/*
* Contributed to the OpenSSL Project by the American Registry for
* Internet Numbers ("ARIN").
goto err;
}
} else {
- char *s = BUF_strdup(val->value);
+ char *s = strdup(val->value);
if (s == NULL) {
X509V3err(X509V3_F_V2I_ASIDENTIFIERS,
ERR_R_MALLOC_FAILURE);
-/* $OpenBSD: v3_enum.c,v 1.9 2014/07/11 08:44:49 jsing Exp $ */
+/* $OpenBSD: v3_enum.c,v 1.10 2014/07/13 16:03:10 beck Exp $ */
/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
* project 1999.
*/
*/
#include <stdio.h>
-
+#include <string.h>
#include <openssl/x509v3.h>
static ENUMERATED_NAMES crl_reasons[] = {
strval = ASN1_ENUMERATED_get(e);
for (enam = method->usr_data; enam->lname; enam++) {
if (strval == enam->bitnum)
- return BUF_strdup(enam->lname);
+ return strdup(enam->lname);
}
return i2s_ASN1_ENUMERATED(method, e);
}
-/* $OpenBSD: v3_purp.c,v 1.21 2014/07/11 08:44:49 jsing Exp $ */
+/* $OpenBSD: v3_purp.c,v 1.22 2014/07/13 16:03:10 beck Exp $ */
/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
* project 2001.
*/
free(ptmp->sname);
}
/* dup supplied name */
- ptmp->name = BUF_strdup(name);
- ptmp->sname = BUF_strdup(sname);
+ ptmp->name = name ? strdup(name) : NULL;
+ ptmp->sname = sname ? strdup(sname) : NULL;
if (!ptmp->name || !ptmp->sname) {
free(ptmp->name);
free(ptmp->sname);
-/* $OpenBSD: v3_utl.c,v 1.22 2014/07/11 08:44:49 jsing Exp $ */
+/* $OpenBSD: v3_utl.c,v 1.23 2014/07/13 16:03:10 beck Exp $ */
/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
* project.
*/
CONF_VALUE *vtmp = NULL;
char *tname = NULL, *tvalue = NULL;
- if (name && !(tname = BUF_strdup(name)))
+ if (name && !(tname = strdup(name)))
goto err;
- if (value && !(tvalue = BUF_strdup(value)))
+ if (value && !(tvalue = strdup(value)))
goto err;
if (!(vtmp = malloc(sizeof(CONF_VALUE))))
goto err;
int state;
/* We are going to modify the line so copy it first */
- linebuf = BUF_strdup(line);
+ if ((linebuf = strdup(line)) == NULL) {
+ X509V3err(X509V3_F_X509V3_PARSE_LIST, ERR_R_MALLOC_FAILURE);
+ goto err;
+ }
state = HDR_NAME;
ntmp = NULL;
/* Don't add duplicates */
if (sk_OPENSSL_STRING_find(*sk, (char *)email->data) != -1)
return 1;
- emtmp = BUF_strdup((char *)email->data);
+ emtmp = strdup((char *)email->data);
if (!emtmp || !sk_OPENSSL_STRING_push(*sk, emtmp)) {
X509_email_free(*sk);
*sk = NULL;
p = strchr(ipasc, '/');
if (!p)
return NULL;
- iptmp = BUF_strdup(ipasc);
+ iptmp = strdup(ipasc);
if (!iptmp)
return NULL;
p = iptmp + (p - ipasc);
-/* $OpenBSD: s3_lib.c,v 1.70 2014/07/12 22:33:39 jsing Exp $ */
+/* $OpenBSD: s3_lib.c,v 1.71 2014/07/13 16:03:10 beck Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
SSL_R_SSL3_EXT_INVALID_SERVERNAME);
return 0;
}
- if ((s->tlsext_hostname = BUF_strdup((char *)parg))
+ if ((s->tlsext_hostname = strdup((char *)parg))
== NULL) {
SSLerr(SSL_F_SSL3_CTRL,
ERR_R_INTERNAL_ERROR);
-/* $OpenBSD: ssl_sess.c,v 1.37 2014/07/12 23:59:11 jsing Exp $ */
+/* $OpenBSD: ssl_sess.c,v 1.38 2014/07/13 16:03:10 beck Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
sess_id_done:
if (s->tlsext_hostname) {
- ss->tlsext_hostname = BUF_strdup(s->tlsext_hostname);
+ ss->tlsext_hostname = strdup(s->tlsext_hostname);
if (ss->tlsext_hostname == NULL) {
SSLerr(SSL_F_SSL_GET_NEW_SESSION,
ERR_R_INTERNAL_ERROR);
-/* $OpenBSD: t1_lib.c,v 1.50 2014/07/12 22:33:39 jsing Exp $ */
+/* $OpenBSD: t1_lib.c,v 1.51 2014/07/13 16:03:10 beck Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
if (!s->hit && tlsext_servername == 1) {
if (s->tlsext_hostname) {
if (s->session->tlsext_hostname == NULL) {
- s->session->tlsext_hostname = BUF_strdup(s->tlsext_hostname);
+ s->session->tlsext_hostname =
+ strdup(s->tlsext_hostname);
if (!s->session->tlsext_hostname) {
*al = SSL_AD_UNRECOGNIZED_NAME;
-/* $OpenBSD: ssl_sess.c,v 1.37 2014/07/12 23:59:11 jsing Exp $ */
+/* $OpenBSD: ssl_sess.c,v 1.38 2014/07/13 16:03:10 beck Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
sess_id_done:
if (s->tlsext_hostname) {
- ss->tlsext_hostname = BUF_strdup(s->tlsext_hostname);
+ ss->tlsext_hostname = strdup(s->tlsext_hostname);
if (ss->tlsext_hostname == NULL) {
SSLerr(SSL_F_SSL_GET_NEW_SESSION,
ERR_R_INTERNAL_ERROR);
-/* $OpenBSD: t1_lib.c,v 1.50 2014/07/12 22:33:39 jsing Exp $ */
+/* $OpenBSD: t1_lib.c,v 1.51 2014/07/13 16:03:10 beck Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
if (!s->hit && tlsext_servername == 1) {
if (s->tlsext_hostname) {
if (s->session->tlsext_hostname == NULL) {
- s->session->tlsext_hostname = BUF_strdup(s->tlsext_hostname);
+ s->session->tlsext_hostname =
+ strdup(s->tlsext_hostname);
if (!s->session->tlsext_hostname) {
*al = SSL_AD_UNRECOGNIZED_NAME;