Check for failure with CBB_init() in bs_ber.c.
authordoug <doug@openbsd.org>
Sun, 21 Jun 2015 16:10:45 +0000 (16:10 +0000)
committerdoug <doug@openbsd.org>
Sun, 21 Jun 2015 16:10:45 +0000 (16:10 +0000)
From BoringSSL commit 3fa65f0f05f67615d9daf48940e07f84d094ac6e.

lib/libssl/bs_ber.c
lib/libssl/src/ssl/bs_ber.c

index 3a391fe..6e945a0 100644 (file)
@@ -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;
index 3a391fe..6e945a0 100644 (file)
@@ -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;