diff options
author | tb <> | 2023-05-23 11:51:12 +0000 |
---|---|---|
committer | tb <> | 2023-05-23 11:51:12 +0000 |
commit | 7cab7499f764c06376e465d4c8264bd7315c181c (patch) | |
tree | 2dcedb027d2360722274907d07f67f3d85dbfac2 /src/lib/libcrypto/asn1/a_object.c | |
parent | c8f9fca94d4424a155a99b10c99da1dd345761a3 (diff) | |
download | openbsd-7cab7499f764c06376e465d4c8264bd7315c181c.tar.gz openbsd-7cab7499f764c06376e465d4c8264bd7315c181c.tar.bz2 openbsd-7cab7499f764c06376e465d4c8264bd7315c181c.zip |
Simplify OBJ_obj2txt()
Instead of adding a NUL termination to OBJ_obj2txt(), move the aobj == NULL
or aobj->data == NULL checks to i2t_ASN1_OBJECT_internal(). The only other
caller, i2t_ASN1_OBJECT(), fails on aobj == NULL and aobj->length == 0, and
the latter condition is implied by aobj->data.
Cleaner solution for obj_dat.c r1.52
suggested by/ok jsing
Diffstat (limited to 'src/lib/libcrypto/asn1/a_object.c')
-rw-r--r-- | src/lib/libcrypto/asn1/a_object.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/lib/libcrypto/asn1/a_object.c b/src/lib/libcrypto/asn1/a_object.c index 8c8ca8537f..af19858f74 100644 --- a/src/lib/libcrypto/asn1/a_object.c +++ b/src/lib/libcrypto/asn1/a_object.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: a_object.c,v 1.49 2022/11/26 16:08:50 tb Exp $ */ | 1 | /* $OpenBSD: a_object.c,v 1.50 2023/05/23 11:51:12 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 | * |
@@ -433,6 +433,9 @@ i2t_ASN1_OBJECT_internal(const ASN1_OBJECT *aobj, char *buf, int buf_len, int no | |||
433 | if (buf_len > 0) | 433 | if (buf_len > 0) |
434 | buf[0] = '\0'; | 434 | buf[0] = '\0'; |
435 | 435 | ||
436 | if (aobj == NULL || aobj->data == NULL) | ||
437 | return 0; | ||
438 | |||
436 | if (!CBB_init(&cbb, 0)) | 439 | if (!CBB_init(&cbb, 0)) |
437 | goto err; | 440 | goto err; |
438 | if (!i2t_ASN1_OBJECT_cbb(aobj, &cbb, no_name)) | 441 | if (!i2t_ASN1_OBJECT_cbb(aobj, &cbb, no_name)) |