summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDoug Hogan <doug@cvs.openbsd.org>2015-06-13 08:46:01 +0000
committerDoug Hogan <doug@cvs.openbsd.org>2015-06-13 08:46:01 +0000
commitec5ffb1be9160dffb34dfa90d3b3f942f443bd6d (patch)
treec262f4044a68951b7bbc09dd7b91682e225b6eb3 /lib
parentb01ec4368ca69f91210a2da466ed0db1001c7425 (diff)
Reject long-form tags in CBS_peek_asn1_tag.
Currently, CBS only handles short-form tags. ok miod@ jsing@
Diffstat (limited to 'lib')
-rw-r--r--lib/libssl/src/ssl/bs_cbs.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/libssl/src/ssl/bs_cbs.c b/lib/libssl/src/ssl/bs_cbs.c
index 4c1bfa32881..c37f81dd60f 100644
--- a/lib/libssl/src/ssl/bs_cbs.c
+++ b/lib/libssl/src/ssl/bs_cbs.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: bs_cbs.c,v 1.7 2015/04/29 02:11:09 doug Exp $ */
+/* $OpenBSD: bs_cbs.c,v 1.8 2015/06/13 08:46:00 doug Exp $ */
/*
* Copyright (c) 2014, Google Inc.
*
@@ -314,6 +314,13 @@ CBS_peek_asn1_tag(const CBS *cbs, unsigned tag_value)
if (CBS_len(cbs) < 1)
return 0;
+ /*
+ * Tag number 31 indicates the start of a long form number.
+ * This is valid in ASN.1, but CBS only supports short form.
+ */
+ if ((tag_value & 0x1f) == 0x1f)
+ return 0;
+
return CBS_data(cbs)[0] == tag_value;
}