diff options
| author | tb <> | 2023-12-14 18:15:21 +0000 |
|---|---|---|
| committer | tb <> | 2023-12-14 18:15:21 +0000 |
| commit | 492cd3b48bee1251f6a03e7bc2fb856bc846db49 (patch) | |
| tree | df6c952f2f16c88922560c9018bf0f8d82ad5f40 /src/lib/libcrypto/objects/obj_dat.c | |
| parent | 83b8387a8c5fb327abfbaaca3fef82e048e83cca (diff) | |
| download | openbsd-492cd3b48bee1251f6a03e7bc2fb856bc846db49.tar.gz openbsd-492cd3b48bee1251f6a03e7bc2fb856bc846db49.tar.bz2 openbsd-492cd3b48bee1251f6a03e7bc2fb856bc846db49.zip | |
OBJ_create: test and assign as usual
Diffstat (limited to 'src/lib/libcrypto/objects/obj_dat.c')
| -rw-r--r-- | src/lib/libcrypto/objects/obj_dat.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/lib/libcrypto/objects/obj_dat.c b/src/lib/libcrypto/objects/obj_dat.c index 600c3a66a6..a2d3ff300c 100644 --- a/src/lib/libcrypto/objects/obj_dat.c +++ b/src/lib/libcrypto/objects/obj_dat.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: obj_dat.c,v 1.76 2023/12/14 18:12:51 tb Exp $ */ | 1 | /* $OpenBSD: obj_dat.c,v 1.77 2023/12/14 18:15:21 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 | * |
| @@ -594,20 +594,20 @@ OBJ_create(const char *oid, const char *sn, const char *ln) | |||
| 594 | int len; | 594 | int len; |
| 595 | int ret = 0; | 595 | int ret = 0; |
| 596 | 596 | ||
| 597 | len = a2d_ASN1_OBJECT(NULL, 0, oid, -1); | 597 | if ((len = a2d_ASN1_OBJECT(NULL, 0, oid, -1)) <= 0) |
| 598 | if (len <= 0) | ||
| 599 | goto err; | 598 | goto err; |
| 600 | 599 | ||
| 601 | if ((buf = malloc(len)) == NULL) { | 600 | if ((buf = malloc(len)) == NULL) { |
| 602 | OBJerror(ERR_R_MALLOC_FAILURE); | 601 | OBJerror(ERR_R_MALLOC_FAILURE); |
| 603 | goto err; | 602 | goto err; |
| 604 | } | 603 | } |
| 605 | len = a2d_ASN1_OBJECT(buf, len, oid, -1); | 604 | |
| 606 | if (len == 0) | 605 | if ((len = a2d_ASN1_OBJECT(buf, len, oid, -1)) == 0) |
| 607 | goto err; | 606 | goto err; |
| 608 | op = ASN1_OBJECT_create(OBJ_new_nid(1), buf, len, sn, ln); | 607 | |
| 609 | if (op == NULL) | 608 | if ((op = ASN1_OBJECT_create(OBJ_new_nid(1), buf, len, sn, ln)) == NULL) |
| 610 | goto err; | 609 | goto err; |
| 610 | |||
| 611 | ret = OBJ_add_object(op); | 611 | ret = OBJ_add_object(op); |
| 612 | 612 | ||
| 613 | err: | 613 | err: |
