[gnome-keyring] egg: Fix ASN.1 issues validating order of SETOF



commit cbecc802e8cf5803aac9fbd3c546b539773220b2
Author: Stef Walter <stefw collabora co uk>
Date:   Mon Sep 12 10:12:03 2011 +0200

    egg: Fix ASN.1 issues validating order of SETOF
    
     * Compare just the value, rather than the entire TLV
     * This fixes some corner cases parsing PKCS#12 files

 egg/egg-asn1x.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
---
diff --git a/egg/egg-asn1x.c b/egg/egg-asn1x.c
index 1463d3b..743ba2c 100644
--- a/egg/egg-asn1x.c
+++ b/egg/egg-asn1x.c
@@ -354,13 +354,13 @@ anode_opts_lookup (GNode *node, gint type, const gchar *name)
 static gint
 compare_tlvs (Atlv *tlva, Atlv *tlvb)
 {
-	gint la = tlva->off + tlva->len;
-	gint lb = tlvb->off + tlvb->len;
+	gint la = tlva->len;
+	gint lb = tlvb->len;
 	gint res;
 
 	g_assert (tlva->buf);
 	g_assert (tlvb->buf);
-	res = memcmp (tlva->buf, tlvb->buf, MIN (la, lb));
+	res = memcmp (tlva->buf + tlva->off, tlvb->buf + tlvb->off, MIN (la, lb));
 	if (la == lb || res != 0)
 		return res;
 	return la < lb ? -1 : 1;



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]