summaryrefslogtreecommitdiffstats
path: root/crypto/bio/bss_mem.c
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:30:57 +0200
commitc6991655c4ce4764861dd5bdf64a92be5f54dbb3 (patch)
tree14e769c64123250479b6be8456f7a77601a1dc85 /crypto/bio/bss_mem.c
parentdaa6f2c0bedc3e54f58fd420a217b74b9ddc1c02 (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) (cherry picked from commit 8b7b32921e63c492fa7233d81b11ee4d7ba266de)
Diffstat (limited to 'crypto/bio/bss_mem.c')
-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 8c621d6c1e..2d536e9db0 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;
}