summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortb <>2023-12-14 18:15:21 +0000
committertb <>2023-12-14 18:15:21 +0000
commit95a1a82839631eb7c6cf9d195c4d8c05692bf678 (patch)
treedf6c952f2f16c88922560c9018bf0f8d82ad5f40
parent4334947bc18dd3a30c548b4ae0a165409fa58ebb (diff)
downloadopenbsd-95a1a82839631eb7c6cf9d195c4d8c05692bf678.tar.gz
openbsd-95a1a82839631eb7c6cf9d195c4d8c05692bf678.tar.bz2
openbsd-95a1a82839631eb7c6cf9d195c4d8c05692bf678.zip
OBJ_create: test and assign as usual
-rw-r--r--src/lib/libcrypto/objects/obj_dat.c14
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: