From: tb Date: Mon, 15 Aug 2022 10:48:45 +0000 (+0000) Subject: Initialize readbytes in BIO_gets() X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=e630eac6035e2df5e9a7bb627d0c36fcb6a68023;p=openbsd 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 --- 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) {