diff options
author | beck <> | 2015-10-16 14:23:22 +0000 |
---|---|---|
committer | beck <> | 2015-10-16 14:23:22 +0000 |
commit | a257720ff1fc941f32aec3258685e6ae8d66fb92 (patch) | |
tree | fc5fb3494bce81dd4de124060210eeb08db72d3d /src/lib | |
parent | ef85c00bb8e1fc022851ced891cd4aa9124ed7e2 (diff) | |
download | openbsd-a257720ff1fc941f32aec3258685e6ae8d66fb92.tar.gz openbsd-a257720ff1fc941f32aec3258685e6ae8d66fb92.tar.bz2 openbsd-a257720ff1fc941f32aec3258685e6ae8d66fb92.zip |
Fix use of pointer value after BIO_free, and remove senseless NULL checks.
ok bcook@
Diffstat (limited to 'src/lib')
-rw-r--r-- | src/lib/libssl/src/ssl/ssl_lib.c | 15 | ||||
-rw-r--r-- | src/lib/libssl/ssl_lib.c | 15 |
2 files changed, 16 insertions, 14 deletions
diff --git a/src/lib/libssl/src/ssl/ssl_lib.c b/src/lib/libssl/src/ssl/ssl_lib.c index 0b094e8db6..6479f729e7 100644 --- a/src/lib/libssl/src/ssl/ssl_lib.c +++ b/src/lib/libssl/src/ssl/ssl_lib.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: ssl_lib.c,v 1.113 2015/10/03 06:47:32 doug Exp $ */ | 1 | /* $OpenBSD: ssl_lib.c,v 1.114 2015/10/16 14:23:22 beck 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 | * |
@@ -502,10 +502,10 @@ SSL_free(SSL *s) | |||
502 | BIO_free(s->bbio); | 502 | BIO_free(s->bbio); |
503 | s->bbio = NULL; | 503 | s->bbio = NULL; |
504 | } | 504 | } |
505 | if (s->rbio != NULL) | 505 | |
506 | BIO_free_all(s->rbio); | 506 | if (s->wbio != s->rbio) |
507 | if ((s->wbio != NULL) && (s->wbio != s->rbio)) | ||
508 | BIO_free_all(s->wbio); | 507 | BIO_free_all(s->wbio); |
508 | BIO_free_all(s->rbio); | ||
509 | 509 | ||
510 | if (s->init_buf != NULL) | 510 | if (s->init_buf != NULL) |
511 | BUF_MEM_free(s->init_buf); | 511 | BUF_MEM_free(s->init_buf); |
@@ -571,10 +571,11 @@ SSL_set_bio(SSL *s, BIO *rbio, BIO *wbio) | |||
571 | s->bbio->next_bio = NULL; | 571 | s->bbio->next_bio = NULL; |
572 | } | 572 | } |
573 | } | 573 | } |
574 | if ((s->rbio != NULL) && (s->rbio != rbio)) | 574 | |
575 | BIO_free_all(s->rbio); | 575 | if ((s->wbio != wbio) && (s->rbio != s->wbio)) |
576 | if ((s->wbio != NULL) && (s->wbio != wbio) && (s->rbio != s->wbio)) | ||
577 | BIO_free_all(s->wbio); | 576 | BIO_free_all(s->wbio); |
577 | if (s->rbio != rbio) | ||
578 | BIO_free_all(s->rbio); | ||
578 | s->rbio = rbio; | 579 | s->rbio = rbio; |
579 | s->wbio = wbio; | 580 | s->wbio = wbio; |
580 | } | 581 | } |
diff --git a/src/lib/libssl/ssl_lib.c b/src/lib/libssl/ssl_lib.c index 0b094e8db6..6479f729e7 100644 --- a/src/lib/libssl/ssl_lib.c +++ b/src/lib/libssl/ssl_lib.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: ssl_lib.c,v 1.113 2015/10/03 06:47:32 doug Exp $ */ | 1 | /* $OpenBSD: ssl_lib.c,v 1.114 2015/10/16 14:23:22 beck 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 | * |
@@ -502,10 +502,10 @@ SSL_free(SSL *s) | |||
502 | BIO_free(s->bbio); | 502 | BIO_free(s->bbio); |
503 | s->bbio = NULL; | 503 | s->bbio = NULL; |
504 | } | 504 | } |
505 | if (s->rbio != NULL) | 505 | |
506 | BIO_free_all(s->rbio); | 506 | if (s->wbio != s->rbio) |
507 | if ((s->wbio != NULL) && (s->wbio != s->rbio)) | ||
508 | BIO_free_all(s->wbio); | 507 | BIO_free_all(s->wbio); |
508 | BIO_free_all(s->rbio); | ||
509 | 509 | ||
510 | if (s->init_buf != NULL) | 510 | if (s->init_buf != NULL) |
511 | BUF_MEM_free(s->init_buf); | 511 | BUF_MEM_free(s->init_buf); |
@@ -571,10 +571,11 @@ SSL_set_bio(SSL *s, BIO *rbio, BIO *wbio) | |||
571 | s->bbio->next_bio = NULL; | 571 | s->bbio->next_bio = NULL; |
572 | } | 572 | } |
573 | } | 573 | } |
574 | if ((s->rbio != NULL) && (s->rbio != rbio)) | 574 | |
575 | BIO_free_all(s->rbio); | 575 | if ((s->wbio != wbio) && (s->rbio != s->wbio)) |
576 | if ((s->wbio != NULL) && (s->wbio != wbio) && (s->rbio != s->wbio)) | ||
577 | BIO_free_all(s->wbio); | 576 | BIO_free_all(s->wbio); |
577 | if (s->rbio != rbio) | ||
578 | BIO_free_all(s->rbio); | ||
578 | s->rbio = rbio; | 579 | s->rbio = rbio; |
579 | s->wbio = wbio; | 580 | s->wbio = wbio; |
580 | } | 581 | } |