From 0d289efd8e15b50466df7a88cafe699f2aeca835 Mon Sep 17 00:00:00 2001 From: doug Date: Sun, 21 Jun 2015 16:10:45 +0000 Subject: [PATCH] Check for failure with CBB_init() in bs_ber.c. From BoringSSL commit 3fa65f0f05f67615d9daf48940e07f84d094ac6e. --- lib/libssl/bs_ber.c | 5 +++-- lib/libssl/src/ssl/bs_ber.c | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/libssl/bs_ber.c b/lib/libssl/bs_ber.c index 3a391fe853f..6e945a02466 100644 --- a/lib/libssl/bs_ber.c +++ b/lib/libssl/bs_ber.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bs_ber.c,v 1.7 2015/06/17 07:20:39 doug Exp $ */ +/* $OpenBSD: bs_ber.c,v 1.8 2015/06/21 16:10:45 doug Exp $ */ /* * Copyright (c) 2014, Google Inc. * @@ -257,7 +257,8 @@ CBS_asn1_indefinite_to_definite(CBS *in, uint8_t **out, size_t *out_len) return 1; } - CBB_init(&cbb, CBS_len(in)); + if (!CBB_init(&cbb, CBS_len(in))) + return 0; if (!cbs_convert_indefinite(in, &cbb, 0, 0, 0)) { CBB_cleanup(&cbb); return 0; diff --git a/lib/libssl/src/ssl/bs_ber.c b/lib/libssl/src/ssl/bs_ber.c index 3a391fe853f..6e945a02466 100644 --- a/lib/libssl/src/ssl/bs_ber.c +++ b/lib/libssl/src/ssl/bs_ber.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bs_ber.c,v 1.7 2015/06/17 07:20:39 doug Exp $ */ +/* $OpenBSD: bs_ber.c,v 1.8 2015/06/21 16:10:45 doug Exp $ */ /* * Copyright (c) 2014, Google Inc. * @@ -257,7 +257,8 @@ CBS_asn1_indefinite_to_definite(CBS *in, uint8_t **out, size_t *out_len) return 1; } - CBB_init(&cbb, CBS_len(in)); + if (!CBB_init(&cbb, CBS_len(in))) + return 0; if (!cbs_convert_indefinite(in, &cbb, 0, 0, 0)) { CBB_cleanup(&cbb); return 0; -- 2.20.1