summaryrefslogtreecommitdiff
path: root/lib/libcrypto/x509v3
diff options
context:
space:
mode:
authorBob Beck <beck@cvs.openbsd.org>2014-07-13 16:03:11 +0000
committerBob Beck <beck@cvs.openbsd.org>2014-07-13 16:03:11 +0000
commit3b5014b592896a484ecfcfa8ccbdd944cac48f8f (patch)
tree43a94bcad4d64d8107649879fb05b6adf11ab450 /lib/libcrypto/x509v3
parentf6fb633a7ef70c9eb8d01de5dbc79fbb9c1228da (diff)
The bell tolls for BUF_strdup - Start the migration to using
intrinsics. This is the easy ones, a few left to check one at a time. ok miod@ deraadt@
Diffstat (limited to 'lib/libcrypto/x509v3')
-rw-r--r--lib/libcrypto/x509v3/v3_addr.c6
-rw-r--r--lib/libcrypto/x509v3/v3_asid.c4
-rw-r--r--lib/libcrypto/x509v3/v3_enum.c6
-rw-r--r--lib/libcrypto/x509v3/v3_purp.c6
-rw-r--r--lib/libcrypto/x509v3/v3_utl.c15
5 files changed, 20 insertions, 17 deletions
diff --git a/lib/libcrypto/x509v3/v3_addr.c b/lib/libcrypto/x509v3/v3_addr.c
index 28031a07548..1e016586c7a 100644
--- a/lib/libcrypto/x509v3/v3_addr.c
+++ b/lib/libcrypto/x509v3/v3_addr.c
@@ -1,4 +1,4 @@
-/* $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").
@@ -1032,9 +1032,9 @@ v2i_IPAddrBlocks(const struct v3_ext_method *method, struct v3_ext_ctx *ctx,
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,
diff --git a/lib/libcrypto/x509v3/v3_asid.c b/lib/libcrypto/x509v3/v3_asid.c
index 4ff8f0da379..680eed31ec6 100644
--- a/lib/libcrypto/x509v3/v3_asid.c
+++ b/lib/libcrypto/x509v3/v3_asid.c
@@ -1,4 +1,4 @@
-/* $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").
@@ -643,7 +643,7 @@ v2i_ASIdentifiers(const struct v3_ext_method *method, struct v3_ext_ctx *ctx,
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);
diff --git a/lib/libcrypto/x509v3/v3_enum.c b/lib/libcrypto/x509v3/v3_enum.c
index 8900d7e01bd..c09601edad2 100644
--- a/lib/libcrypto/x509v3/v3_enum.c
+++ b/lib/libcrypto/x509v3/v3_enum.c
@@ -1,4 +1,4 @@
-/* $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.
*/
@@ -57,7 +57,7 @@
*/
#include <stdio.h>
-
+#include <string.h>
#include <openssl/x509v3.h>
static ENUMERATED_NAMES crl_reasons[] = {
@@ -93,7 +93,7 @@ i2s_ASN1_ENUMERATED_TABLE(X509V3_EXT_METHOD *method, ASN1_ENUMERATED *e)
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);
}
diff --git a/lib/libcrypto/x509v3/v3_purp.c b/lib/libcrypto/x509v3/v3_purp.c
index 03fb4272771..b8db8d69a22 100644
--- a/lib/libcrypto/x509v3/v3_purp.c
+++ b/lib/libcrypto/x509v3/v3_purp.c
@@ -1,4 +1,4 @@
-/* $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.
*/
@@ -227,8 +227,8 @@ X509_PURPOSE_add(int id, int trust, int flags,
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);
diff --git a/lib/libcrypto/x509v3/v3_utl.c b/lib/libcrypto/x509v3/v3_utl.c
index d9987e32a5b..99090f3cd27 100644
--- a/lib/libcrypto/x509v3/v3_utl.c
+++ b/lib/libcrypto/x509v3/v3_utl.c
@@ -1,4 +1,4 @@
-/* $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.
*/
@@ -87,9 +87,9 @@ X509V3_add_value(const char *name, const char *value,
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;
@@ -301,7 +301,10 @@ X509V3_parse_list(const char *line)
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;
@@ -632,7 +635,7 @@ append_ia5(STACK_OF(OPENSSL_STRING) **sk, ASN1_IA5STRING *email)
/* 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;
@@ -686,7 +689,7 @@ a2i_IPADDRESS_NC(const char *ipasc)
p = strchr(ipasc, '/');
if (!p)
return NULL;
- iptmp = BUF_strdup(ipasc);
+ iptmp = strdup(ipasc);
if (!iptmp)
return NULL;
p = iptmp + (p - ipasc);