summaryrefslogtreecommitdiffstats
path: root/src/crypto/bytestring/cbb.c
diff options
context:
space:
mode:
authorAdam Langley <agl@google.com>2015-05-11 17:20:37 -0700
committerKenny Root <kroot@google.com>2015-05-12 23:06:14 +0000
commite9ada863a7b3e81f5d2b1e3bdd2305da902a87f5 (patch)
tree6e43e34595ecf887c26c32b86d8ab097fe8cac64 /src/crypto/bytestring/cbb.c
parentb3106a0cc1493bbe0505c0ec0ce3da4ca90a29ae (diff)
downloadexternal_boringssl-e9ada863a7b3e81f5d2b1e3bdd2305da902a87f5.zip
external_boringssl-e9ada863a7b3e81f5d2b1e3bdd2305da902a87f5.tar.gz
external_boringssl-e9ada863a7b3e81f5d2b1e3bdd2305da902a87f5.tar.bz2
external/boringssl: bump revision.
This change bumps the BoringSSL revision to the current tip-of-tree. Change-Id: I91d5bf467e16e8d86cb19a4de873985f524e5faa
Diffstat (limited to 'src/crypto/bytestring/cbb.c')
-rw-r--r--src/crypto/bytestring/cbb.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/crypto/bytestring/cbb.c b/src/crypto/bytestring/cbb.c
index 4428836..f1e09a2 100644
--- a/src/crypto/bytestring/cbb.c
+++ b/src/crypto/bytestring/cbb.c
@@ -25,7 +25,6 @@ static int cbb_init(CBB *cbb, uint8_t *buf, size_t cap) {
base = OPENSSL_malloc(sizeof(struct cbb_buffer_st));
if (base == NULL) {
- OPENSSL_free(buf);
return 0;
}
@@ -48,7 +47,12 @@ int CBB_init(CBB *cbb, size_t initial_capacity) {
return 0;
}
- return cbb_init(cbb, buf, initial_capacity);
+ if (!cbb_init(cbb, buf, initial_capacity)) {
+ OPENSSL_free(buf);
+ return 0;
+ }
+
+ return 1;
}
int CBB_init_fixed(CBB *cbb, uint8_t *buf, size_t len) {
@@ -62,7 +66,7 @@ int CBB_init_fixed(CBB *cbb, uint8_t *buf, size_t len) {
void CBB_cleanup(CBB *cbb) {
if (cbb->base) {
- if (cbb->base->buf && cbb->base->can_resize) {
+ if (cbb->base->can_resize) {
OPENSSL_free(cbb->base->buf);
}
OPENSSL_free(cbb->base);
@@ -276,6 +280,11 @@ int CBB_add_u24_length_prefixed(CBB *cbb, CBB *out_contents) {
}
int CBB_add_asn1(CBB *cbb, CBB *out_contents, uint8_t tag) {
+ if ((tag & 0x1f) == 0x1f) {
+ /* Long form identifier octets are not supported. */
+ return 0;
+ }
+
if (!CBB_flush(cbb) ||
!CBB_add_u8(cbb, tag)) {
return 0;