Don't try to use zero-byte buffers.

This commit is contained in:
Bodo Möller 1999-06-15 18:07:44 +00:00
parent d486601f41
commit 6c82fda2dd
3 changed files with 7 additions and 0 deletions

View file

@ -618,6 +618,7 @@ int BIO_printf(BIO *bio, ...);
#define BIO_R_ERROR_SETTING_NBIO_ON_ACCEPTED_SOCKET 105 #define BIO_R_ERROR_SETTING_NBIO_ON_ACCEPTED_SOCKET 105
#define BIO_R_ERROR_SETTING_NBIO_ON_ACCEPT_SOCKET 106 #define BIO_R_ERROR_SETTING_NBIO_ON_ACCEPT_SOCKET 106
#define BIO_R_GETHOSTBYNAME_ADDR_IS_NOT_AF_INET 107 #define BIO_R_GETHOSTBYNAME_ADDR_IS_NOT_AF_INET 107
#define BIO_R_INVALID_ARGUMENT 125
#define BIO_R_INVALID_IP_ADDRESS 108 #define BIO_R_INVALID_IP_ADDRESS 108
#define BIO_R_IN_USE 123 #define BIO_R_IN_USE 123
#define BIO_R_KEEPALIVE 109 #define BIO_R_KEEPALIVE 109

View file

@ -101,6 +101,7 @@ static ERR_STRING_DATA BIO_str_reasons[]=
{BIO_R_ERROR_SETTING_NBIO_ON_ACCEPTED_SOCKET,"error setting nbio on accepted socket"}, {BIO_R_ERROR_SETTING_NBIO_ON_ACCEPTED_SOCKET,"error setting nbio on accepted socket"},
{BIO_R_ERROR_SETTING_NBIO_ON_ACCEPT_SOCKET,"error setting nbio on accept socket"}, {BIO_R_ERROR_SETTING_NBIO_ON_ACCEPT_SOCKET,"error setting nbio on accept socket"},
{BIO_R_GETHOSTBYNAME_ADDR_IS_NOT_AF_INET ,"gethostbyname addr is not af inet"}, {BIO_R_GETHOSTBYNAME_ADDR_IS_NOT_AF_INET ,"gethostbyname addr is not af inet"},
{BIO_R_INVALID_ARGUMENT ,"invalid argument"},
{BIO_R_INVALID_IP_ADDRESS ,"invalid ip address"}, {BIO_R_INVALID_IP_ADDRESS ,"invalid ip address"},
{BIO_R_IN_USE ,"in use"}, {BIO_R_IN_USE ,"in use"},
{BIO_R_KEEPALIVE ,"keepalive"}, {BIO_R_KEEPALIVE ,"keepalive"},

View file

@ -280,6 +280,11 @@ static long bio_ctrl(BIO *bio, int cmd, long num, void *ptr)
BIOerr(BIO_F_BIO_CTRL, BIO_R_IN_USE); BIOerr(BIO_F_BIO_CTRL, BIO_R_IN_USE);
ret = 0; ret = 0;
} }
else if (num == 0)
{
BIOerr(BIO_F_BIO_CTRL, BIO_R_INVALID_ARGUMENT);
ret = 0;
}
else else
{ {
size_t new_size = num; size_t new_size = num;