From fb0780c1eafaf53d294ee4f8ba1f65685668a53b Mon Sep 17 00:00:00 2001 From: Leon Lynch Date: Sat, 29 Jun 2024 14:42:24 +0200 Subject: [PATCH] Minor improvement to printing of Data Object List (DOL) fields * It is safe to assume that DOL fields will never have an associated value string * Remove the colon when printing DOL entries because it will not be followed by a data buffer --- tools/print_helpers.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/tools/print_helpers.c b/tools/print_helpers.c index 68fb46c..e24c81c 100644 --- a/tools/print_helpers.c +++ b/tools/print_helpers.c @@ -419,9 +419,11 @@ void print_emv_tlv(const struct emv_tlv_t* tlv, const char* prefix, unsigned int printf("%s%02X", i ? " " : "", tlv->value[i]); } - // If empty value string or value string is list or Data Object List (DOL), - // end this line and continue on the next line - if (!value_str[0] || str_is_list(value_str) || info.format == EMV_FORMAT_DOL) { + // If the value string is empty or the value string is a list, end this + // line and continue on the next line. This implementation assumes that + // Data Object List (DOL) fields or Tag List fields will allways have + // an empty value string. + if (!value_str[0] || str_is_list(value_str)) { printf("\n"); if (str_is_list(value_str)) { @@ -511,9 +513,9 @@ void print_emv_dol(const void* ptr, size_t len, const char* prefix, unsigned int } if (info.tag_name) { - printf("%02X | %s : [%u]\n", entry.tag, info.tag_name, entry.length); + printf("%02X | %s [%u]\n", entry.tag, info.tag_name, entry.length); } else { - printf("%02X : [%u]\n", entry.tag, entry.length); + printf("%02X [%u]\n", entry.tag, entry.length); } } }