File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1304,8 +1304,10 @@ size_t wolfSSL_BIO_ctrl_pending(WOLFSSL_BIO *bio)
13041304 }
13051305
13061306 if (bio -> method != NULL && bio -> method -> ctrlCb != NULL ) {
1307+ long ret ;
13071308 WOLFSSL_MSG ("Calling custom BIO ctrl pending callback" );
1308- return (size_t )bio -> method -> ctrlCb (bio , WOLFSSL_BIO_CTRL_PENDING , 0 , NULL );
1309+ ret = bio -> method -> ctrlCb (bio , WOLFSSL_BIO_CTRL_PENDING , 0 , NULL );
1310+ return (ret < 0 ) ? 0 : (size_t )ret ;
13091311 }
13101312
13111313 if (bio -> type == WOLFSSL_BIO_MD ||
Original file line number Diff line number Diff line change @@ -1469,11 +1469,12 @@ int test_wolfSSL_BIO_BIO_ring_read(void)
14691469/* Custom BIO backing store for test_wolfSSL_BIO_custom_method */
14701470#if defined(OPENSSL_EXTRA )
14711471
1472+ static int custom_bio_destroyCalled = 0 ;
1473+
14721474struct custom_bio_data {
14731475 char buf [256 ];
14741476 int len ;
14751477 byte createCalled :1 ;
1476- byte destroyCalled :1 ;
14771478 byte writeCalled :1 ;
14781479 byte readCalled :1 ;
14791480 byte putsCalled :1 ;
@@ -1499,7 +1500,7 @@ static int custom_bio_destroyCb(WOLFSSL_BIO* bio)
14991500{
15001501 struct custom_bio_data * data = (struct custom_bio_data * )BIO_get_data (bio );
15011502 if (data != NULL ) {
1502- data -> destroyCalled = 1 ;
1503+ custom_bio_destroyCalled = 1 ;
15031504 XFREE (data , NULL , DYNAMIC_TYPE_TMP_BUFFER );
15041505 }
15051506 BIO_set_data (bio , NULL );
@@ -1669,7 +1670,9 @@ int test_wolfSSL_BIO_custom_method(void)
16691670 ExpectIntEQ ((int )BIO_ctrl_pending (bio ), 0 );
16701671
16711672 /* free - should invoke destroyCb */
1673+ custom_bio_destroyCalled = 0 ;
16721674 BIO_free (bio );
1675+ ExpectTrue (custom_bio_destroyCalled );
16731676 BIO_meth_free (method );
16741677#endif
16751678 return EXPECT_RESULT ();
You can’t perform that action at this time.
0 commit comments