From ec5ffb1be9160dffb34dfa90d3b3f942f443bd6d Mon Sep 17 00:00:00 2001 From: Doug Hogan Date: Sat, 13 Jun 2015 08:46:01 +0000 Subject: Reject long-form tags in CBS_peek_asn1_tag. Currently, CBS only handles short-form tags. ok miod@ jsing@ --- lib/libssl/src/ssl/bs_cbs.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'lib') 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; } -- cgit v1.2.3