summaryrefslogtreecommitdiff
path: root/lib/libssl/bs_cbs.c
diff options
context:
space:
mode:
authorDoug Hogan <doug@cvs.openbsd.org>2015-04-29 01:23:21 +0000
committerDoug Hogan <doug@cvs.openbsd.org>2015-04-29 01:23:21 +0000
commiteb991b8896c3b3bbfbd50b6a3e77e6d6ae965fd3 (patch)
treecd87022ab496865487e99070479368df77f32c81 /lib/libssl/bs_cbs.c
parent089248566d3c557bd78b4d2a043bb90d16ef6e1d (diff)
Added error checking for len argument in cbs_get_u().
tweak + ok jsing@
Diffstat (limited to 'lib/libssl/bs_cbs.c')
-rw-r--r--lib/libssl/bs_cbs.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/libssl/bs_cbs.c b/lib/libssl/bs_cbs.c
index 25305b9edd2..fc2eafff0eb 100644
--- a/lib/libssl/bs_cbs.c
+++ b/lib/libssl/bs_cbs.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: bs_cbs.c,v 1.4 2015/04/29 01:16:06 doug Exp $ */
+/* $OpenBSD: bs_cbs.c,v 1.5 2015/04/29 01:23:20 doug Exp $ */
/*
* Copyright (c) 2014, Google Inc.
*
@@ -110,6 +110,9 @@ cbs_get_u(CBS *cbs, uint32_t *out, size_t len)
size_t i;
const uint8_t *data;
+ if (len < 1 || len > 4)
+ return 0;
+
if (!cbs_get(cbs, &data, len))
return 0;