Don't try to use zero-byte buffers.
authorBodo Möller <bodo@openssl.org>
Tue, 15 Jun 1999 18:07:44 +0000 (18:07 +0000)
committerBodo Möller <bodo@openssl.org>
Tue, 15 Jun 1999 18:07:44 +0000 (18:07 +0000)
crypto/bio/bio.h
crypto/bio/bio_err.c
crypto/bio/bss_bio.c

index 5d1654a..54bf622 100644 (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_ACCEPT_SOCKET       106
 #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_IN_USE                                    123
 #define BIO_R_KEEPALIVE                                         109
index e31bf32..712d98a 100644 (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_ACCEPT_SOCKET,"error setting nbio on accept socket"},
 {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_IN_USE                            ,"in use"},
 {BIO_R_KEEPALIVE                         ,"keepalive"},
index dae8b3b..a1991a7 100644 (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);
                        ret = 0;
                        }
+               else if (num == 0)
+                       {
+                       BIOerr(BIO_F_BIO_CTRL, BIO_R_INVALID_ARGUMENT);
+                       ret = 0;
+                       }
                else
                        {
                        size_t new_size = num;