summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authortb <>2022-08-15 10:48:45 +0000
committertb <>2022-08-15 10:48:45 +0000
commit9f26ac3b2e739359268e4e255f97592ccafe1f89 (patch)
tree7421765d11bb68e0eebaf8618fd16487d5f70c3d /src
parent7034880f5bf50568a6106afb6ec5c2e3725b5a9e (diff)
downloadopenbsd-9f26ac3b2e739359268e4e255f97592ccafe1f89.tar.gz
openbsd-9f26ac3b2e739359268e4e255f97592ccafe1f89.tar.bz2
openbsd-9f26ac3b2e739359268e4e255f97592ccafe1f89.zip
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
Diffstat (limited to 'src')
-rw-r--r--src/lib/libcrypto/bio/bio_lib.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/lib/libcrypto/bio/bio_lib.c b/src/lib/libcrypto/bio/bio_lib.c
index 0b6c9ecac0..2ac0abd82e 100644
--- a/src/lib/libcrypto/bio/bio_lib.c
+++ b/src/lib/libcrypto/bio/bio_lib.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: bio_lib.c,v 1.35 2022/01/14 08:40:57 tb Exp $ */ 1/* $OpenBSD: bio_lib.c,v 1.36 2022/08/15 10:48:45 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 *
@@ -464,7 +464,7 @@ BIO_puts(BIO *b, const char *in)
464int 464int
465BIO_gets(BIO *b, char *in, int inl) 465BIO_gets(BIO *b, char *in, int inl)
466{ 466{
467 size_t readbytes; 467 size_t readbytes = 0;
468 int ret; 468 int ret;
469 469
470 if (b == NULL || b->method == NULL || b->method->bgets == NULL) { 470 if (b == NULL || b->method == NULL || b->method->bgets == NULL) {