Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/boringssl.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Benjamin <davidben@chromium.org>2015-05-16 02:11:57 +0300
committerAdam Langley <agl@google.com>2015-05-21 21:00:10 +0300
commit3fa65f0f05f67615d9daf48940e07f84d094ac6e (patch)
tree9c4c6b56547b20c13098624e4442f1fad6941ffd /crypto/bio
parent0b635c52b241af78b69addecbb84c7d55f3cabb4 (diff)
Fix some malloc test crashs.
This isn't exhaustive. There are still failures in some tests which probably ought to get C++'d first. Change-Id: Iac58df9d98cdfd94603d54374a531b2559df64c3 Reviewed-on: https://boringssl-review.googlesource.com/4795 Reviewed-by: Adam Langley <agl@google.com>
Diffstat (limited to 'crypto/bio')
-rw-r--r--crypto/bio/printf.c6
-rw-r--r--crypto/bio/socket_helper.c2
2 files changed, 4 insertions, 4 deletions
diff --git a/crypto/bio/printf.c b/crypto/bio/printf.c
index 3638915b..f51b3960 100644
--- a/crypto/bio/printf.c
+++ b/crypto/bio/printf.c
@@ -64,6 +64,7 @@
#include <stdarg.h>
#include <stdio.h>
+#include <openssl/err.h>
#include <openssl/mem.h>
int BIO_printf(BIO *bio, const char *format, ...) {
@@ -94,9 +95,8 @@ int BIO_printf(BIO *bio, const char *format, ...) {
out = OPENSSL_malloc(requested_len + 1);
out_malloced = 1;
if (out == NULL) {
- /* Unclear what can be done in this situation. OpenSSL has historically
- * crashed and that seems better than producing the wrong output. */
- abort();
+ OPENSSL_PUT_ERROR(BIO, BIO_printf, ERR_R_MALLOC_FAILURE);
+ return -1;
}
va_start(args, format);
out_len = vsnprintf(out, requested_len + 1, format, args);
diff --git a/crypto/bio/socket_helper.c b/crypto/bio/socket_helper.c
index 197c7370..b1cdd1ac 100644
--- a/crypto/bio/socket_helper.c
+++ b/crypto/bio/socket_helper.c
@@ -51,7 +51,7 @@ int bio_ip_and_port_to_socket_and_addr(int *out_sock,
ret = getaddrinfo(hostname, port_str, &hint, &result);
if (ret != 0) {
OPENSSL_PUT_ERROR(SYS, getaddrinfo, 0);
- ERR_add_error_data(2, gai_strerror(ret));
+ ERR_add_error_data(1, gai_strerror(ret));
return 0;
}