From 4c74ebdc5655e9c0c4ddc9352cb3503da8fc815c Mon Sep 17 00:00:00 2001 From: Klas Lindfors Date: Thu, 17 Mar 2016 10:21:18 +0100 Subject: [PATCH] actually open output_file in attest() --- tool/yubico-piv-tool.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tool/yubico-piv-tool.c b/tool/yubico-piv-tool.c index f3b6465..6b43ebe 100644 --- a/tool/yubico-piv-tool.c +++ b/tool/yubico-piv-tool.c @@ -1648,7 +1648,6 @@ static bool list_readers(ykpiv_state *state) { static bool attest(ykpiv_state *state, const char *slot, enum enum_key_format key_format, const char *output_file_name) { - FILE *output_file; unsigned char data[2048]; unsigned long len = sizeof(data); bool ret = false; @@ -1656,6 +1655,10 @@ static bool attest(ykpiv_state *state, const char *slot, unsigned char templ[] = {0, YKPIV_INS_ATTEST, 0, 0}; int key; int sw; + FILE *output_file = open_file(output_file_name, OUTPUT); + if(!output_file) { + return false; + } sscanf(slot, "%2x", &key); templ[2] = key;