From 29a93d2889baa74b6cafa51ee17ec7596bc78013 Mon Sep 17 00:00:00 2001 From: Mark Andrews Date: Tue, 11 Jul 2023 17:57:25 +1000 Subject: [PATCH] Check that buf is large enough (cherry picked from commit 299f519b09a18d9093815999c6b39664c6aaf81e) --- lib/dns/opensslecdsa_link.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/dns/opensslecdsa_link.c b/lib/dns/opensslecdsa_link.c index d994387931..b80d637383 100644 --- a/lib/dns/opensslecdsa_link.c +++ b/lib/dns/opensslecdsa_link.c @@ -258,6 +258,8 @@ static int BN_bn2bin_fixed(const BIGNUM *bn, unsigned char *buf, int size) { int bytes = size - BN_num_bytes(bn); + INSIST(bytes >= 0); + while (bytes-- > 0) { *buf++ = 0; }