diff options
| author | beck <> | 2014-07-13 16:03:10 +0000 |
|---|---|---|
| committer | beck <> | 2014-07-13 16:03:10 +0000 |
| commit | c7e9c2c6576cd5406680f9b69aff2038ba63b0dc (patch) | |
| tree | c2bbb8405534dcf838bc686b6748045284f3966b /src/lib/libcrypto/x509v3 | |
| parent | 679de7876fe8228887034f815ef2e29db63ba752 (diff) | |
| download | openbsd-c7e9c2c6576cd5406680f9b69aff2038ba63b0dc.tar.gz openbsd-c7e9c2c6576cd5406680f9b69aff2038ba63b0dc.tar.bz2 openbsd-c7e9c2c6576cd5406680f9b69aff2038ba63b0dc.zip | |
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 'src/lib/libcrypto/x509v3')
| -rw-r--r-- | src/lib/libcrypto/x509v3/v3_addr.c | 6 | ||||
| -rw-r--r-- | src/lib/libcrypto/x509v3/v3_asid.c | 4 | ||||
| -rw-r--r-- | src/lib/libcrypto/x509v3/v3_enum.c | 6 | ||||
| -rw-r--r-- | src/lib/libcrypto/x509v3/v3_purp.c | 6 | ||||
| -rw-r--r-- | src/lib/libcrypto/x509v3/v3_utl.c | 15 |
5 files changed, 20 insertions, 17 deletions
diff --git a/src/lib/libcrypto/x509v3/v3_addr.c b/src/lib/libcrypto/x509v3/v3_addr.c index 28031a0754..1e016586c7 100644 --- a/src/lib/libcrypto/x509v3/v3_addr.c +++ b/src/lib/libcrypto/x509v3/v3_addr.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: v3_addr.c,v 1.12 2014/07/11 08:44:49 jsing Exp $ */ | 1 | /* $OpenBSD: v3_addr.c,v 1.13 2014/07/13 16:03:10 beck Exp $ */ |
| 2 | /* | 2 | /* |
| 3 | * Contributed to the OpenSSL Project by the American Registry for | 3 | * Contributed to the OpenSSL Project by the American Registry for |
| 4 | * Internet Numbers ("ARIN"). | 4 | * Internet Numbers ("ARIN"). |
| @@ -1032,9 +1032,9 @@ v2i_IPAddrBlocks(const struct v3_ext_method *method, struct v3_ext_ctx *ctx, | |||
| 1032 | goto err; | 1032 | goto err; |
| 1033 | } | 1033 | } |
| 1034 | t += strspn(t, " \t"); | 1034 | t += strspn(t, " \t"); |
| 1035 | s = BUF_strdup(t); | 1035 | s = strdup(t); |
| 1036 | } else { | 1036 | } else { |
| 1037 | s = BUF_strdup(val->value); | 1037 | s = strdup(val->value); |
| 1038 | } | 1038 | } |
| 1039 | if (s == NULL) { | 1039 | if (s == NULL) { |
| 1040 | X509V3err(X509V3_F_V2I_IPADDRBLOCKS, | 1040 | X509V3err(X509V3_F_V2I_IPADDRBLOCKS, |
diff --git a/src/lib/libcrypto/x509v3/v3_asid.c b/src/lib/libcrypto/x509v3/v3_asid.c index 4ff8f0da37..680eed31ec 100644 --- a/src/lib/libcrypto/x509v3/v3_asid.c +++ b/src/lib/libcrypto/x509v3/v3_asid.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: v3_asid.c,v 1.10 2014/07/11 08:44:49 jsing Exp $ */ | 1 | /* $OpenBSD: v3_asid.c,v 1.11 2014/07/13 16:03:10 beck Exp $ */ |
| 2 | /* | 2 | /* |
| 3 | * Contributed to the OpenSSL Project by the American Registry for | 3 | * Contributed to the OpenSSL Project by the American Registry for |
| 4 | * Internet Numbers ("ARIN"). | 4 | * Internet Numbers ("ARIN"). |
| @@ -643,7 +643,7 @@ v2i_ASIdentifiers(const struct v3_ext_method *method, struct v3_ext_ctx *ctx, | |||
| 643 | goto err; | 643 | goto err; |
| 644 | } | 644 | } |
| 645 | } else { | 645 | } else { |
| 646 | char *s = BUF_strdup(val->value); | 646 | char *s = strdup(val->value); |
| 647 | if (s == NULL) { | 647 | if (s == NULL) { |
| 648 | X509V3err(X509V3_F_V2I_ASIDENTIFIERS, | 648 | X509V3err(X509V3_F_V2I_ASIDENTIFIERS, |
| 649 | ERR_R_MALLOC_FAILURE); | 649 | ERR_R_MALLOC_FAILURE); |
diff --git a/src/lib/libcrypto/x509v3/v3_enum.c b/src/lib/libcrypto/x509v3/v3_enum.c index 8900d7e01b..c09601edad 100644 --- a/src/lib/libcrypto/x509v3/v3_enum.c +++ b/src/lib/libcrypto/x509v3/v3_enum.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: v3_enum.c,v 1.9 2014/07/11 08:44:49 jsing Exp $ */ | 1 | /* $OpenBSD: v3_enum.c,v 1.10 2014/07/13 16:03:10 beck Exp $ */ |
| 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL | 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL |
| 3 | * project 1999. | 3 | * project 1999. |
| 4 | */ | 4 | */ |
| @@ -57,7 +57,7 @@ | |||
| 57 | */ | 57 | */ |
| 58 | 58 | ||
| 59 | #include <stdio.h> | 59 | #include <stdio.h> |
| 60 | 60 | #include <string.h> | |
| 61 | #include <openssl/x509v3.h> | 61 | #include <openssl/x509v3.h> |
| 62 | 62 | ||
| 63 | static ENUMERATED_NAMES crl_reasons[] = { | 63 | static ENUMERATED_NAMES crl_reasons[] = { |
| @@ -93,7 +93,7 @@ i2s_ASN1_ENUMERATED_TABLE(X509V3_EXT_METHOD *method, ASN1_ENUMERATED *e) | |||
| 93 | strval = ASN1_ENUMERATED_get(e); | 93 | strval = ASN1_ENUMERATED_get(e); |
| 94 | for (enam = method->usr_data; enam->lname; enam++) { | 94 | for (enam = method->usr_data; enam->lname; enam++) { |
| 95 | if (strval == enam->bitnum) | 95 | if (strval == enam->bitnum) |
| 96 | return BUF_strdup(enam->lname); | 96 | return strdup(enam->lname); |
| 97 | } | 97 | } |
| 98 | return i2s_ASN1_ENUMERATED(method, e); | 98 | return i2s_ASN1_ENUMERATED(method, e); |
| 99 | } | 99 | } |
diff --git a/src/lib/libcrypto/x509v3/v3_purp.c b/src/lib/libcrypto/x509v3/v3_purp.c index 03fb427277..b8db8d69a2 100644 --- a/src/lib/libcrypto/x509v3/v3_purp.c +++ b/src/lib/libcrypto/x509v3/v3_purp.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: v3_purp.c,v 1.21 2014/07/11 08:44:49 jsing Exp $ */ | 1 | /* $OpenBSD: v3_purp.c,v 1.22 2014/07/13 16:03:10 beck Exp $ */ |
| 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL | 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL |
| 3 | * project 2001. | 3 | * project 2001. |
| 4 | */ | 4 | */ |
| @@ -227,8 +227,8 @@ X509_PURPOSE_add(int id, int trust, int flags, | |||
| 227 | free(ptmp->sname); | 227 | free(ptmp->sname); |
| 228 | } | 228 | } |
| 229 | /* dup supplied name */ | 229 | /* dup supplied name */ |
| 230 | ptmp->name = BUF_strdup(name); | 230 | ptmp->name = name ? strdup(name) : NULL; |
| 231 | ptmp->sname = BUF_strdup(sname); | 231 | ptmp->sname = sname ? strdup(sname) : NULL; |
| 232 | if (!ptmp->name || !ptmp->sname) { | 232 | if (!ptmp->name || !ptmp->sname) { |
| 233 | free(ptmp->name); | 233 | free(ptmp->name); |
| 234 | free(ptmp->sname); | 234 | free(ptmp->sname); |
diff --git a/src/lib/libcrypto/x509v3/v3_utl.c b/src/lib/libcrypto/x509v3/v3_utl.c index d9987e32a5..99090f3cd2 100644 --- a/src/lib/libcrypto/x509v3/v3_utl.c +++ b/src/lib/libcrypto/x509v3/v3_utl.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: v3_utl.c,v 1.22 2014/07/11 08:44:49 jsing Exp $ */ | 1 | /* $OpenBSD: v3_utl.c,v 1.23 2014/07/13 16:03:10 beck Exp $ */ |
| 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL | 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL |
| 3 | * project. | 3 | * project. |
| 4 | */ | 4 | */ |
| @@ -87,9 +87,9 @@ X509V3_add_value(const char *name, const char *value, | |||
| 87 | CONF_VALUE *vtmp = NULL; | 87 | CONF_VALUE *vtmp = NULL; |
| 88 | char *tname = NULL, *tvalue = NULL; | 88 | char *tname = NULL, *tvalue = NULL; |
| 89 | 89 | ||
| 90 | if (name && !(tname = BUF_strdup(name))) | 90 | if (name && !(tname = strdup(name))) |
| 91 | goto err; | 91 | goto err; |
| 92 | if (value && !(tvalue = BUF_strdup(value))) | 92 | if (value && !(tvalue = strdup(value))) |
| 93 | goto err; | 93 | goto err; |
| 94 | if (!(vtmp = malloc(sizeof(CONF_VALUE)))) | 94 | if (!(vtmp = malloc(sizeof(CONF_VALUE)))) |
| 95 | goto err; | 95 | goto err; |
| @@ -301,7 +301,10 @@ X509V3_parse_list(const char *line) | |||
| 301 | int state; | 301 | int state; |
| 302 | 302 | ||
| 303 | /* We are going to modify the line so copy it first */ | 303 | /* We are going to modify the line so copy it first */ |
| 304 | linebuf = BUF_strdup(line); | 304 | if ((linebuf = strdup(line)) == NULL) { |
| 305 | X509V3err(X509V3_F_X509V3_PARSE_LIST, ERR_R_MALLOC_FAILURE); | ||
| 306 | goto err; | ||
| 307 | } | ||
| 305 | state = HDR_NAME; | 308 | state = HDR_NAME; |
| 306 | ntmp = NULL; | 309 | ntmp = NULL; |
| 307 | 310 | ||
| @@ -632,7 +635,7 @@ append_ia5(STACK_OF(OPENSSL_STRING) **sk, ASN1_IA5STRING *email) | |||
| 632 | /* Don't add duplicates */ | 635 | /* Don't add duplicates */ |
| 633 | if (sk_OPENSSL_STRING_find(*sk, (char *)email->data) != -1) | 636 | if (sk_OPENSSL_STRING_find(*sk, (char *)email->data) != -1) |
| 634 | return 1; | 637 | return 1; |
| 635 | emtmp = BUF_strdup((char *)email->data); | 638 | emtmp = strdup((char *)email->data); |
| 636 | if (!emtmp || !sk_OPENSSL_STRING_push(*sk, emtmp)) { | 639 | if (!emtmp || !sk_OPENSSL_STRING_push(*sk, emtmp)) { |
| 637 | X509_email_free(*sk); | 640 | X509_email_free(*sk); |
| 638 | *sk = NULL; | 641 | *sk = NULL; |
| @@ -686,7 +689,7 @@ a2i_IPADDRESS_NC(const char *ipasc) | |||
| 686 | p = strchr(ipasc, '/'); | 689 | p = strchr(ipasc, '/'); |
| 687 | if (!p) | 690 | if (!p) |
| 688 | return NULL; | 691 | return NULL; |
| 689 | iptmp = BUF_strdup(ipasc); | 692 | iptmp = strdup(ipasc); |
| 690 | if (!iptmp) | 693 | if (!iptmp) |
| 691 | return NULL; | 694 | return NULL; |
| 692 | p = iptmp + (p - ipasc); | 695 | p = iptmp + (p - ipasc); |
