diff options
| author | tb <> | 2023-05-23 11:51:12 +0000 |
|---|---|---|
| committer | tb <> | 2023-05-23 11:51:12 +0000 |
| commit | 6825aba8c0202893f32509537fbfa606a2459325 (patch) | |
| tree | 2dcedb027d2360722274907d07f67f3d85dbfac2 /src/lib/libcrypto/objects/obj_dat.c | |
| parent | bdde2af02514a12044135087400ae31ed4bede39 (diff) | |
| download | openbsd-6825aba8c0202893f32509537fbfa606a2459325.tar.gz openbsd-6825aba8c0202893f32509537fbfa606a2459325.tar.bz2 openbsd-6825aba8c0202893f32509537fbfa606a2459325.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/objects/obj_dat.c')
| -rw-r--r-- | src/lib/libcrypto/objects/obj_dat.c | 8 |
1 files changed, 1 insertions, 7 deletions
diff --git a/src/lib/libcrypto/objects/obj_dat.c b/src/lib/libcrypto/objects/obj_dat.c index fcc21ddfb4..7516a6d09a 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.52 2023/05/23 11:04:04 tb Exp $ */ | 1 | /* $OpenBSD: obj_dat.c,v 1.53 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 | * |
| @@ -499,12 +499,6 @@ OBJ_txt2obj(const char *s, int no_name) | |||
| 499 | int | 499 | int |
| 500 | OBJ_obj2txt(char *buf, int buf_len, const ASN1_OBJECT *aobj, int no_name) | 500 | OBJ_obj2txt(char *buf, int buf_len, const ASN1_OBJECT *aobj, int no_name) |
| 501 | { | 501 | { |
| 502 | if (buf_len > 0) | ||
| 503 | buf[0] = '\0'; | ||
| 504 | |||
| 505 | if (aobj == NULL || aobj->data == NULL) | ||
| 506 | return 0; | ||
| 507 | |||
| 508 | return i2t_ASN1_OBJECT_internal(aobj, buf, buf_len, no_name); | 502 | return i2t_ASN1_OBJECT_internal(aobj, buf, buf_len, no_name); |
| 509 | } | 503 | } |
| 510 | 504 | ||
