Skip to content

Commit 8da9669

Browse files
committed
wolfssl_file_len: return WOLFSSL_BAD_FILETYPE on pipe type
1 parent fcc4679 commit 8da9669

2 files changed

Lines changed: 5 additions & 2 deletions

File tree

src/bio.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1938,6 +1938,8 @@ int wolfSSL_BIO_get_len(WOLFSSL_BIO *bio)
19381938
len = BAD_FUNC_ARG;
19391939
if (len == 0) {
19401940
len = wolfssl_file_len(file, &memSz);
1941+
if (len == WC_NO_ERR_TRACE(WOLFSSL_BAD_FILETYPE))
1942+
len = 0;
19411943
}
19421944
if (len == 0) {
19431945
len = (int)memSz;

src/ssl_misc.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -233,9 +233,10 @@ static int wolfssl_file_len(XFILE fp, long* fileSz)
233233
if (errno == ESPIPE) {
234234
WOLFSSL_ERROR_MSG("wolfssl_file_len: file is a pipe");
235235
*fileSz = 0;
236-
return 0;
236+
ret = WOLFSSL_BAD_FILETYPE;
237237
}
238-
ret = WOLFSSL_BAD_FILE;
238+
else
239+
ret = WOLFSSL_BAD_FILE;
239240
}
240241
}
241242
/* Move to end of file. */

0 commit comments

Comments
 (0)