bss_dgram.c is deferred until later due to ongoing discussions.
Reviewed-by: Andy Polyakov <appro@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/3740)
* https://www.openssl.org/source/license.html
*/
+#include <assert.h>
#include <string.h>
#include "bio_lcl.h"
unsigned short port,
BIO_ADDRINFO **bai)
{
- OPENSSL_assert(bai != NULL);
+ if (bai == NULL)
+ return 0;
*bai = OPENSSL_zalloc(sizeof(**bai));
if (*bai == NULL)
he_fallback_address = INADDR_ANY;
break;
default:
- OPENSSL_assert(("We forgot to handle a lookup type!" == 0));
- break;
+ /* We forgot to handle a lookup type! */
+ assert("We forgot to handle a lookup type!" == NULL);
+ BIOerr(BIO_F_BIO_LOOKUP_EX, ERR_R_INTERNAL_ERROR);
+ ret = 0;
+ goto err;
}
} else {
he = gethostbyname(host);
char **buffer, size_t *currlen, size_t *maxlen, int c)
{
/* If we haven't at least one buffer, someone has doe a big booboo */
- OPENSSL_assert(*sbuffer != NULL || buffer != NULL);
+ if (!ossl_assert(*sbuffer != NULL || buffer != NULL))
+ return 0;
/* |currlen| must always be <= |*maxlen| */
- OPENSSL_assert(*currlen <= *maxlen);
+ if (!ossl_assert(*currlen <= *maxlen))
+ return 0;
if (buffer && *currlen == *maxlen) {
if (*maxlen > INT_MAX - BUFFER_INC)
if (*buffer == NULL)
return 0;
if (*currlen > 0) {
- OPENSSL_assert(*sbuffer != NULL);
+ if (!ossl_assert(*sbuffer != NULL))
+ return 0;
memcpy(*buffer, *sbuffer, *currlen);
}
*sbuffer = NULL;
if (BIO_ADDRINFO_family(res) != AF_INET) {
BIOerr(BIO_F_BIO_GET_HOST_IP,
BIO_R_GETHOSTBYNAME_ADDR_IS_NOT_AF_INET);
- } else {
- BIO_ADDR_rawaddress(BIO_ADDRINFO_address(res), NULL, &l);
- /* Because only AF_INET addresses will reach this far,
- we can assert that l should be 4 */
- OPENSSL_assert(l == 4);
-
- BIO_ADDR_rawaddress(BIO_ADDRINFO_address(res), ip, &l);
- ret = 1;
+ } else if (BIO_ADDR_rawaddress(BIO_ADDRINFO_address(res), NULL, &l)) {
+ /*
+ * Because only AF_INET addresses will reach this far, we can assert
+ * that l should be 4
+ */
+ if (ossl_assert(l == 4))
+ ret = BIO_ADDR_rawaddress(BIO_ADDRINFO_address(res), ip, &l);
}
BIO_ADDRINFO_free(res);
} else {