From 781ee797d4e37872fb3e4c1f8a43f22b22bcc6e3 Mon Sep 17 00:00:00 2001 From: Theo Buehler Date: Wed, 29 May 2024 16:10:42 +0000 Subject: Make i2d_ASN1_OBJECT() return -1 on error This is what the (not quite appropriately) referenced ASN1_item_i2d() page documents for errors, matches what the RETURN VALUE section has been documenting for ages, matches BoringSSL, it's the usal behavior for i2d_*. It's also what OpenSSL (of course incorrectly) documents. discussed with jsing --- lib/libcrypto/asn1/a_object.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/libcrypto/asn1/a_object.c b/lib/libcrypto/asn1/a_object.c index 00b5e7af92d..aae1b8bbd78 100644 --- a/lib/libcrypto/asn1/a_object.c +++ b/lib/libcrypto/asn1/a_object.c @@ -1,4 +1,4 @@ -/* $OpenBSD: a_object.c,v 1.52 2024/05/29 16:04:50 tb Exp $ */ +/* $OpenBSD: a_object.c,v 1.53 2024/05/29 16:10:41 tb Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -619,7 +619,7 @@ i2d_ASN1_OBJECT(const ASN1_OBJECT *a, unsigned char **pp) int objsize; if (a == NULL || a->data == NULL) - return 0; + return -1; objsize = ASN1_object_size(0, a->length, V_ASN1_OBJECT); -- cgit v1.2.3