X-Git-Url: https://git.openssl.org/?p=openssl.git;a=blobdiff_plain;f=crypto%2Fbio%2Fbss_bio.c;h=0ad55e0e53b8027d1b9a7d0c1e2f9f0286e29833;hp=5b60f541a128917c0092856938d62c1a707e6f98;hb=1aad3392e531aa9d32583b435ba4f0b296ee4d27;hpb=9e06f6f6019198e3f84cbfc9ff5d561400db4d7e diff --git a/crypto/bio/bss_bio.c b/crypto/bio/bss_bio.c index 5b60f541a1..0ad55e0e53 100644 --- a/crypto/bio/bss_bio.c +++ b/crypto/bio/bss_bio.c @@ -46,7 +46,8 @@ struct bio_bio_st { BIO *peer; /* NULL if buf == NULL. * If peer != NULL, then peer->ptr is also a bio_bio_st, - * and its "peer" member points back to us. */ + * and its "peer" member points back to us. + * peer != NULL iff init != 0 in the BIO. */ /* This is for what we write (i.e. reading uses peer's struct): */ int closed; /* valid iff peer != NULL */ @@ -197,7 +198,7 @@ static int bio_make_pair(BIO *bio1, BIO *bio2) return 0; } - if (b1->buf != NULL) + if (b1->buf == NULL) { b1->buf = Malloc(b1->size); if (b1->buf == NULL) @@ -209,7 +210,7 @@ static int bio_make_pair(BIO *bio1, BIO *bio2) b1->offset = 0; } - if (b2->buf != NULL) + if (b2->buf == NULL) { b2->buf = Malloc(b2->size); if (b2->buf == NULL) @@ -224,6 +225,9 @@ static int bio_make_pair(BIO *bio1, BIO *bio2) b1->peer = bio2; b2->peer = bio1; + bio1->init = 1; + bio2->init = 1; + return 1; }