summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorTheo Buehler <tb@cvs.openbsd.org>2022-03-03 08:06:58 +0000
committerTheo Buehler <tb@cvs.openbsd.org>2022-03-03 08:06:58 +0000
commit55d6fa902a6851be288ec7d26b37e2e42c51963b (patch)
treee8dd18115a825344faedef8d0b4e83e096b0df8e /lib
parentfd154c06d20cbfb648c2c5a1011cfe0ad1f183c8 (diff)
Do not write out terminating NUL in i2a_ASN1_OBJECT()
The conversion to CBB made us write out an extra NUL since we no longer use the return value of i2t_ASN1_OBJECT() (which returns strlen(data)) but rather the size of the CBB (which includes a terminal NUL) to write out data. Issue found by anton via an openssl-ruby test failure. ok jsing
Diffstat (limited to 'lib')
-rw-r--r--lib/libcrypto/asn1/a_object.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/libcrypto/asn1/a_object.c b/lib/libcrypto/asn1/a_object.c
index c355e5ed209..9a784fd1a66 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.39 2022/03/02 17:45:39 tb Exp $ */
+/* $OpenBSD: a_object.c,v 1.40 2022/03/03 08:06:57 tb Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
@@ -447,7 +447,7 @@ i2a_ASN1_OBJECT(BIO *bp, const ASN1_OBJECT *aobj)
if (!CBB_finish(&cbb, &data, &data_len))
goto err;
- ret = BIO_write(bp, data, data_len);
+ ret = BIO_write(bp, data, strlen(data));
err:
CBB_cleanup(&cbb);