]> git.zerfleddert.de Git - proxmark3-svn/blobdiff - client/emv/tlv.c
Code improved for less memory
[proxmark3-svn] / client / emv / tlv.c
index 9722c9311ec9cd485daab3527c7e9b245781b12b..5472c47ad82e8debfe51190fed2cd227b5349ca1 100644 (file)
@@ -352,7 +352,13 @@ struct tlvdb *tlvdb_find_path(struct tlvdb *tlvdb, tlv_tag_t tag[]) {
 
 void tlvdb_add(struct tlvdb *tlvdb, struct tlvdb *other)
 {
 
 void tlvdb_add(struct tlvdb *tlvdb, struct tlvdb *other)
 {
+       if (tlvdb == other)
+               return;
+       
        while (tlvdb->next) {
        while (tlvdb->next) {
+               if (tlvdb->next == other)
+                       return;
+               
                tlvdb = tlvdb->next;
        }
 
                tlvdb = tlvdb->next;
        }
 
@@ -582,3 +588,9 @@ bool tlv_get_int(const struct tlv *etlv, int *value)
        }
        return false;
 }
        }
        return false;
 }
+
+bool tlvdb_get_uint8(struct tlvdb *tlvRoot, tlv_tag_t tag, uint8_t *value)
+{
+       const struct tlv *tlvelm = tlvdb_get(tlvRoot, tag, NULL);       
+       return tlv_get_uint8(tlvelm, value);
+}
Impressum, Datenschutz