The branch OpenSSL_1_1_0-stable has been updated via 913d3a644edafee2a20c620e8625e9f3be49f643 (commit) from c4a53021b953e8c279e50b39b561dfda83fa597d (commit)
- Log ----------------------------------------------------------------- commit 913d3a644edafee2a20c620e8625e9f3be49f643 Author: Rich Salz <rs...@openssl.org> Date: Fri Apr 28 14:14:59 2017 -0400 Check fflush on BIO_ctrl call Bug found and fix suggested by Julian RĂ¼th. Push error if fflush fails Reviewed-by: Richard Levitte <levi...@openssl.org> (Merged from https://github.com/openssl/openssl/pull/3266) (cherry picked from commit 595b2a42375427a254ad5a8c85870efea839a9b9) ----------------------------------------------------------------------- Summary of changes: crypto/bio/bss_file.c | 13 +++++++++---- crypto/err/err.c | 1 + include/openssl/err.h | 1 + 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/crypto/bio/bss_file.c b/crypto/bio/bss_file.c index 6af2d9c..e3d8c0e 100644 --- a/crypto/bio/bss_file.c +++ b/crypto/bio/bss_file.c @@ -186,6 +186,7 @@ static long file_ctrl(BIO *b, int cmd, long num, void *ptr) FILE *fp = (FILE *)b->ptr; FILE **fpp; char p[4]; + int st; switch (cmd) { case BIO_C_FILE_SEEK: @@ -313,10 +314,14 @@ static long file_ctrl(BIO *b, int cmd, long num, void *ptr) b->shutdown = (int)num; break; case BIO_CTRL_FLUSH: - if (b->flags & BIO_FLAGS_UPLINK) - UP_fflush(b->ptr); - else - fflush((FILE *)b->ptr); + st = b->flags & BIO_FLAGS_UPLINK + ? UP_fflush(b->ptr) : fflush((FILE *)b->ptr); + if (st == EOF) { + SYSerr(SYS_F_FFLUSH, get_last_sys_error()); + ERR_add_error_data(1, "fflush()"); + BIOerr(BIO_F_FILE_CTRL, ERR_R_SYS_LIB); + ret = 0; + } break; case BIO_CTRL_DUP: ret = 1; diff --git a/crypto/err/err.c b/crypto/err/err.c index d5cad05..f866f2f 100644 --- a/crypto/err/err.c +++ b/crypto/err/err.c @@ -82,6 +82,7 @@ static ERR_STRING_DATA ERR_str_functs[] = { {ERR_PACK(0, SYS_F_GETSOCKOPT, 0), "getsockopt"}, {ERR_PACK(0, SYS_F_GETSOCKNAME, 0), "getsockname"}, {ERR_PACK(0, SYS_F_GETHOSTBYNAME, 0), "gethostbyname"}, + {ERR_PACK(0, SYS_F_FFLUSH, 0), "fflush"}, {0, NULL}, }; diff --git a/include/openssl/err.h b/include/openssl/err.h index 9bbe9e1..29a261c 100644 --- a/include/openssl/err.h +++ b/include/openssl/err.h @@ -159,6 +159,7 @@ typedef struct err_state_st { # define SYS_F_GETSOCKOPT 15 # define SYS_F_GETSOCKNAME 16 # define SYS_F_GETHOSTBYNAME 17 +# define SYS_F_FFLUSH 18 /* reasons */ # define ERR_R_SYS_LIB ERR_LIB_SYS/* 2 */ _____ openssl-commits mailing list To unsubscribe: https://mta.openssl.org/mailman/listinfo/openssl-commits