summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/lib/libssl/bs_cbb.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/lib/libssl/bs_cbb.c b/src/lib/libssl/bs_cbb.c
index a34e822c94..16e17fb70f 100644
--- a/src/lib/libssl/bs_cbb.c
+++ b/src/lib/libssl/bs_cbb.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: bs_cbb.c,v 1.20 2019/01/23 22:20:40 beck Exp $ */ 1/* $OpenBSD: bs_cbb.c,v 1.21 2020/03/12 17:17:12 jsing Exp $ */
2/* 2/*
3 * Copyright (c) 2014, Google Inc. 3 * Copyright (c) 2014, Google Inc.
4 * 4 *
@@ -28,8 +28,7 @@ cbb_init(CBB *cbb, uint8_t *buf, size_t cap)
28{ 28{
29 struct cbb_buffer_st *base; 29 struct cbb_buffer_st *base;
30 30
31 base = malloc(sizeof(struct cbb_buffer_st)); 31 if ((base = calloc(1, sizeof(struct cbb_buffer_st))) == NULL)
32 if (base == NULL)
33 return 0; 32 return 0;
34 33
35 base->buf = buf; 34 base->buf = buf;
@@ -53,7 +52,7 @@ CBB_init(CBB *cbb, size_t initial_capacity)
53 if (initial_capacity == 0) 52 if (initial_capacity == 0)
54 initial_capacity = CBB_INITIAL_SIZE; 53 initial_capacity = CBB_INITIAL_SIZE;
55 54
56 if ((buf = malloc(initial_capacity)) == NULL) 55 if ((buf = calloc(1, initial_capacity)) == NULL)
57 return 0; 56 return 0;
58 57
59 if (!cbb_init(cbb, buf, initial_capacity)) { 58 if (!cbb_init(cbb, buf, initial_capacity)) {