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 5d1654aaefc6e3e701b71e9dcdd43dbeaaa328d2..54bf622a3bd52371efbb12e899aafe50927deb38 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 e31bf32aa43b3e67a98ab388f3664cb1079fdc68..712d98a3a1a907b4bdfe8d68bc96eb2842d7b3a0 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 dae8b3b3e2eeace87ab1b26ac5f72cdf4adcd8f2..a1991a7b909e9e2ec36bcd18f11cb3adebcfc2e4 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;