summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbeck <>2019-01-23 22:20:40 +0000
committerbeck <>2019-01-23 22:20:40 +0000
commit06e6b71d917b831ea28543a745e306fa001eaf62 (patch)
tree6096f1c3edd51d9fcb2c8780e15a2723125c8b8c
parent934b3985a409d7e0a88557dd4313222194a110bd (diff)
downloadopenbsd-06e6b71d917b831ea28543a745e306fa001eaf62.tar.gz
openbsd-06e6b71d917b831ea28543a745e306fa001eaf62.tar.bz2
openbsd-06e6b71d917b831ea28543a745e306fa001eaf62.zip
assert.h is often misused. It should not be used in a library
ok bcook@ jsing@
-rw-r--r--src/lib/libssl/bs_cbb.c6
-rw-r--r--src/lib/libssl/bs_cbs.c7
2 files changed, 5 insertions, 8 deletions
diff --git a/src/lib/libssl/bs_cbb.c b/src/lib/libssl/bs_cbb.c
index beb588fe25..a34e822c94 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.19 2018/08/16 18:39:37 jsing Exp $ */ 1/* $OpenBSD: bs_cbb.c,v 1.20 2019/01/23 22:20:40 beck Exp $ */
2/* 2/*
3 * Copyright (c) 2014, Google Inc. 3 * Copyright (c) 2014, Google Inc.
4 * 4 *
@@ -14,7 +14,6 @@
14 * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN 14 * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
15 * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ 15 * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */
16 16
17#include <assert.h>
18#include <stdlib.h> 17#include <stdlib.h>
19#include <string.h> 18#include <string.h>
20 19
@@ -214,7 +213,8 @@ CBB_flush(CBB *cbb)
214 uint8_t initial_length_byte; 213 uint8_t initial_length_byte;
215 214
216 /* We already wrote 1 byte for the length. */ 215 /* We already wrote 1 byte for the length. */
217 assert (cbb->pending_len_len == 1); 216 if (cbb->pending_len_len != 1)
217 return 0;
218 218
219 /* Check for long form */ 219 /* Check for long form */
220 if (len > 0xfffffffe) 220 if (len > 0xfffffffe)
diff --git a/src/lib/libssl/bs_cbs.c b/src/lib/libssl/bs_cbs.c
index ea1f0108f6..5c3b9e3ec6 100644
--- a/src/lib/libssl/bs_cbs.c
+++ b/src/lib/libssl/bs_cbs.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: bs_cbs.c,v 1.17 2015/06/24 09:44:18 jsing Exp $ */ 1/* $OpenBSD: bs_cbs.c,v 1.18 2019/01/23 22:20:40 beck Exp $ */
2/* 2/*
3 * Copyright (c) 2014, Google Inc. 3 * Copyright (c) 2014, Google Inc.
4 * 4 *
@@ -14,7 +14,6 @@
14 * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN 14 * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
15 * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ 15 * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */
16 16
17#include <assert.h>
18#include <stdlib.h> 17#include <stdlib.h>
19#include <string.h> 18#include <string.h>
20 19
@@ -347,10 +346,8 @@ cbs_get_asn1(CBS *cbs, CBS *out, unsigned int tag_value, int skip_header)
347 tag != tag_value) 346 tag != tag_value)
348 return 0; 347 return 0;
349 348
350 if (skip_header && !CBS_skip(out, header_len)) { 349 if (skip_header && !CBS_skip(out, header_len))
351 assert(0);
352 return 0; 350 return 0;
353 }
354 351
355 return 1; 352 return 1;
356} 353}