diff options
| author | tb <> | 2025-01-27 08:05:02 +0000 | 
|---|---|---|
| committer | tb <> | 2025-01-27 08:05:02 +0000 | 
| commit | cfc89821fb8ac6caa5aeda9bc8b2b11572ace14c (patch) | |
| tree | a22e29790cd4eb2a4dc7f9f8a9ba1e5656a2d7c9 /src/lib/libc | |
| parent | 6e5c75f4054d28460f58b77c786448f3ba338e0b (diff) | |
| download | openbsd-cfc89821fb8ac6caa5aeda9bc8b2b11572ace14c.tar.gz openbsd-cfc89821fb8ac6caa5aeda9bc8b2b11572ace14c.tar.bz2 openbsd-cfc89821fb8ac6caa5aeda9bc8b2b11572ace14c.zip | |
X509_NAME_print: NUL-terminate and switch to BIO_printf()
This handles the empty string, which ruby-openssl checks.
Pointed out by anton
Diffstat (limited to '')
| -rw-r--r-- | src/lib/libcrypto/asn1/t_x509.c | 7 | 
1 files changed, 5 insertions, 2 deletions
| diff --git a/src/lib/libcrypto/asn1/t_x509.c b/src/lib/libcrypto/asn1/t_x509.c index 669aec0093..d71e2d2e9a 100644 --- a/src/lib/libcrypto/asn1/t_x509.c +++ b/src/lib/libcrypto/asn1/t_x509.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: t_x509.c,v 1.48 2025/01/26 20:18:26 tb Exp $ */ | 1 | /* $OpenBSD: t_x509.c,v 1.49 2025/01/27 08:05:02 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 | * | 
| @@ -549,13 +549,16 @@ X509_NAME_print(BIO *bio, const X509_NAME *name, int obase) | |||
| 549 | started = 1; | 549 | started = 1; | 
| 550 | } | 550 | } | 
| 551 | 551 | ||
| 552 | if (!CBB_add_u8(&cbb, '\0')) | ||
| 553 | goto err; | ||
| 554 | |||
| 552 | if (!CBB_finish(&cbb, &buf, &buf_len)) | 555 | if (!CBB_finish(&cbb, &buf, &buf_len)) | 
| 553 | goto err; | 556 | goto err; | 
| 554 | 557 | ||
| 555 | if (buf_len > INT_MAX) | 558 | if (buf_len > INT_MAX) | 
| 556 | goto err; | 559 | goto err; | 
| 557 | 560 | ||
| 558 | if (BIO_write(bio, buf, buf_len) <= 0) | 561 | if (BIO_printf(bio, "%s", buf) < 0) | 
| 559 | goto err; | 562 | goto err; | 
| 560 | 563 | ||
| 561 | ret = 1; | 564 | ret = 1; | 
