diff options
author | Nikos Mavrogiannopoulos <nmav@gnutls.org> | 2015-02-05 10:30:14 +0100 |
---|---|---|
committer | Nikos Mavrogiannopoulos <nmav@gnutls.org> | 2015-02-05 10:33:14 +0100 |
commit | edaff43f27c3e1bcf8317ecee9f733a995602b72 (patch) | |
tree | c4eeb7b6dbeb9a38364345e77ae6e4a765af14ac | |
parent | b27f1ad7dbfd248d98bc54ab5969ea4429c6b92d (diff) | |
download | libtasn1-edaff43f27c3e1bcf8317ecee9f733a995602b72.tar.gz |
only assign value if the previous node has one
This addresses the crash in the ASN.1 definitions parser
reported in http://lists.gnu.org/archive/html/help-libtasn1/2015-01/msg00000.html
-rw-r--r-- | lib/parser_aux.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/lib/parser_aux.c b/lib/parser_aux.c index 4b15000..d3e9009 100644 --- a/lib/parser_aux.c +++ b/lib/parser_aux.c @@ -701,9 +701,12 @@ _asn1_expand_object_id (asn1_node node) p5 = _asn1_add_single_node (ASN1_ETYPE_CONSTANT); _asn1_set_name (p5, p4->name); - tlen = _asn1_strlen (p4->value); - if (tlen > 0) - _asn1_set_value (p5, p4->value, tlen + 1); + if (p4->value) + { + tlen = _asn1_strlen (p4->value); + if (tlen > 0) + _asn1_set_value (p5, p4->value, tlen + 1); + } if (p2 == p) { _asn1_set_right (p5, p->down); |