From 35d75051b04d3c3dfb519ffeccbaef6641af36a9 Mon Sep 17 00:00:00 2001 From: Klas Lindfors Date: Tue, 17 Mar 2015 12:41:42 +0100 Subject: [PATCH] don't try to parse returned data if it was an error --- lib/ykpiv.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/lib/ykpiv.c b/lib/ykpiv.c index 655c16c..fdb6716 100644 --- a/lib/ykpiv.c +++ b/lib/ykpiv.c @@ -666,13 +666,11 @@ ykpiv_rc ykpiv_fetch_object(ykpiv_state *state, int object_id, return res; } - { + if(sw == 0x9000) { size_t outlen; int offs = get_length(data + 1, &outlen); memmove(data, data + 1 + offs, outlen); *len = outlen; - } - if(sw == 0x9000) { return YKPIV_OK; } else { return YKPIV_GENERIC_ERROR;