diff options
author | tb <> | 2022-03-03 08:06:57 +0000 |
---|---|---|
committer | tb <> | 2022-03-03 08:06:57 +0000 |
commit | 62855c8784b772e2e48eb371a15223bb4f7dbb91 (patch) | |
tree | f72e864f2411cb013c3b5e480adf8d237e4b1349 | |
parent | e1b11278a865932b9b7f8f0b46d05df1424c98c6 (diff) | |
download | openbsd-62855c8784b772e2e48eb371a15223bb4f7dbb91.tar.gz openbsd-62855c8784b772e2e48eb371a15223bb4f7dbb91.tar.bz2 openbsd-62855c8784b772e2e48eb371a15223bb4f7dbb91.zip |
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
-rw-r--r-- | src/lib/libcrypto/asn1/a_object.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/lib/libcrypto/asn1/a_object.c b/src/lib/libcrypto/asn1/a_object.c index c355e5ed20..9a784fd1a6 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.39 2022/03/02 17:45:39 tb Exp $ */ | 1 | /* $OpenBSD: a_object.c,v 1.40 2022/03/03 08:06:57 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 | * |
@@ -447,7 +447,7 @@ i2a_ASN1_OBJECT(BIO *bp, const ASN1_OBJECT *aobj) | |||
447 | if (!CBB_finish(&cbb, &data, &data_len)) | 447 | if (!CBB_finish(&cbb, &data, &data_len)) |
448 | goto err; | 448 | goto err; |
449 | 449 | ||
450 | ret = BIO_write(bp, data, data_len); | 450 | ret = BIO_write(bp, data, strlen(data)); |
451 | 451 | ||
452 | err: | 452 | err: |
453 | CBB_cleanup(&cbb); | 453 | CBB_cleanup(&cbb); |