From d1c8496ffe265a9c009564ca80d00d8ac9e6a8ce Mon Sep 17 00:00:00 2001 From: tb Date: Wed, 6 Sep 2023 15:32:54 +0000 Subject: [PATCH] Avoid use-of-uninitialized in i2r_IPAddrBlocks() Reported by Viktor Szakats in https://github.com/libressl/portable/issues/910 ok job --- lib/libcrypto/x509/x509_addr.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/libcrypto/x509/x509_addr.c b/lib/libcrypto/x509/x509_addr.c index 2d8cc0b3180c..0506fe3a6435 100644 --- a/lib/libcrypto/x509/x509_addr.c +++ b/lib/libcrypto/x509/x509_addr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: x509_addr.c,v 1.86 2023/02/16 08:38:17 tb Exp $ */ +/* $OpenBSD: x509_addr.c,v 1.87 2023/09/06 15:32:54 tb Exp $ */ /* * Contributed to the OpenSSL Project by the American Registry for * Internet Numbers ("ARIN"). @@ -413,6 +413,13 @@ IPAddressFamily_afi_safi(const IPAddressFamily *af, uint16_t *out_afi, uint8_t safi = 0; int got_safi = 0; + if (out_afi != NULL) + *out_afi = 0; + if (out_safi != NULL) { + *out_safi = 0; + *safi_is_set = 0; + } + CBS_init(&cbs, af->addressFamily->data, af->addressFamily->length); if (!CBS_get_u16(&cbs, &afi))