From e630eac6035e2df5e9a7bb627d0c36fcb6a68023 Mon Sep 17 00:00:00 2001 From: tb Date: Mon, 15 Aug 2022 10:48:45 +0000 Subject: [PATCH] Initialize readbytes in BIO_gets() If the bgets() callback returns <= 0, we currently rely on the user provided callback to set readbytes, which isn't ideal. This also matches what's done in BIO_read() and BIO_write(). ok jsing --- lib/libcrypto/bio/bio_lib.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/libcrypto/bio/bio_lib.c b/lib/libcrypto/bio/bio_lib.c index 0b6c9ecac0d..2ac0abd82e4 100644 --- a/lib/libcrypto/bio/bio_lib.c +++ b/lib/libcrypto/bio/bio_lib.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bio_lib.c,v 1.35 2022/01/14 08:40:57 tb Exp $ */ +/* $OpenBSD: bio_lib.c,v 1.36 2022/08/15 10:48:45 tb Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -464,7 +464,7 @@ BIO_puts(BIO *b, const char *in) int BIO_gets(BIO *b, char *in, int inl) { - size_t readbytes; + size_t readbytes = 0; int ret; if (b == NULL || b->method == NULL || b->method->bgets == NULL) { -- 2.20.1