From fb0c4375339af51ec653166b6dc4b981603ce55e Mon Sep 17 00:00:00 2001 From: Klas Lindfors Date: Thu, 9 Jul 2015 11:00:22 +0200 Subject: [PATCH] check result from get_length() found with clang scan-build --- lib/ykpiv.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/ykpiv.c b/lib/ykpiv.c index b992602..c17adc6 100644 --- a/lib/ykpiv.c +++ b/lib/ykpiv.c @@ -710,6 +710,9 @@ ykpiv_rc ykpiv_fetch_object(ykpiv_state *state, int object_id, if(sw == 0x9000) { size_t outlen; int offs = get_length(data + 1, &outlen); + if(offs == 0) { + return YKPIV_SIZE_ERROR; + } memmove(data, data + 1 + offs, outlen); *len = outlen; return YKPIV_OK;