From 8f18a9abf21b69a91abefb7b949c91dc20abf082 Mon Sep 17 00:00:00 2001 From: iceman1001 Date: Wed, 9 Jan 2019 12:07:07 +0100 Subject: [PATCH] CHG: tvl tag length adapted --- client/emv/emvjson.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/client/emv/emvjson.c b/client/emv/emvjson.c index 116e16da1..f8cccddf2 100644 --- a/client/emv/emvjson.c +++ b/client/emv/emvjson.c @@ -372,13 +372,13 @@ bool ParamLoadFromJson(struct tlvdb *tlv) { size_t buflen = 0; // here max length must be 4, but now tlv_tag_t is 2-byte var. so let it be 2 by now... TODO: needs refactoring tlv_tag_t... - if (!HexToBuffer("TLV Error type:", tlvTag, buf, 2, &buflen)) { + if (!HexToBuffer("TLV Error type:", tlvTag, buf, 4, &buflen)) { json_decref(root); return false; } tlv_tag_t tag = 0; for (int i = 0; i < buflen; i++) { - tag = (tag << 8) + buf[i]; + tag = (tag << 8) | buf[i]; } if (!HexToBuffer("TLV Error value:", tlvValue, buf, sizeof(buf) - 1, &buflen)) {