From 5cb2a5e1628ab28e4dbb56f6b834c858ee736b98 Mon Sep 17 00:00:00 2001 From: Gerald Combs Date: Tue, 20 Sep 2005 17:24:23 +0000 Subject: Fix a couple of errors found by valgrind. svn path=/trunk/; revision=15900 --- epan/asn1.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'epan/asn1.c') diff --git a/epan/asn1.c b/epan/asn1.c index 5d118479aa..299ab537b7 100644 --- a/epan/asn1.c +++ b/epan/asn1.c @@ -896,8 +896,11 @@ asn1_oid_value_decode ( ASN1_SCK *asn1, int enc_len, subid_t **oid, guint *len) * but that's another matter; in any case, that would happen only * if we had an immensely large tvbuff....) */ - if (enc_len != 0) - tvb_ensure_bytes_exist(asn1->tvb, asn1->offset, enc_len); + if (enc_len < 1) { + *oid = NULL; + return ASN1_ERR_LENGTH_MISMATCH; + } + tvb_ensure_bytes_exist(asn1->tvb, asn1->offset, enc_len); eoc = asn1->offset + enc_len; -- cgit v1.2.3