summaryrefslogtreecommitdiffstats
path: root/crypto
diff options
context:
space:
mode:
authorTomas Mraz <tmraz@fedoraproject.org>2019-06-18 16:41:48 +0200
committerTomas Mraz <tmraz@fedoraproject.org>2019-06-19 14:29:27 +0200
commit8b7b32921e63c492fa7233d81b11ee4d7ba266de (patch)
treeff5c3fcb6f67477a811d3da6fa312755037f33ba /crypto
parenta1998897f66858ec7d2d184e98f2be1e46ae2d78 (diff)
Fix and document BIO_FLAGS_NONCLEAR_RST behavior on memory BIO
The BIO_FLAGS_NONCLEAR_RST flag behavior was not properly documented and it also caused the length to be incorrectly set after the reset operation. Reviewed-by: Bernd Edlinger <bernd.edlinger@hotmail.de> Reviewed-by: Paul Dale <paul.dale@oracle.com> (Merged from https://github.com/openssl/openssl/pull/9179)
Diffstat (limited to 'crypto')
-rw-r--r--crypto/bio/bss_mem.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/crypto/bio/bss_mem.c b/crypto/bio/bss_mem.c
index a7f2bfbae0..19a3bd88ba 100644
--- a/crypto/bio/bss_mem.c
+++ b/crypto/bio/bss_mem.c
@@ -259,9 +259,7 @@ static long mem_ctrl(BIO *b, int cmd, long num, void *ptr)
bm = bbm->buf;
if (bm->data != NULL) {
if (!(b->flags & BIO_FLAGS_MEM_RDONLY)) {
- if (b->flags & BIO_FLAGS_NONCLEAR_RST) {
- bm->length = bm->max;
- } else {
+ if (!(b->flags & BIO_FLAGS_NONCLEAR_RST)) {
memset(bm->data, 0, bm->max);
bm->length = 0;
}