From c15efbfdd72b1952f0b9b3a75f0cee985973bfe5 Mon Sep 17 00:00:00 2001 From: Klas Lindfors Date: Thu, 16 Aug 2018 14:23:16 +0200 Subject: [PATCH] ykpiv: fix length when encoding exactly 0xff bytes this should be encoded as 81 ff, not 82 00 ff relates #154 --- lib/ykpiv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/ykpiv.c b/lib/ykpiv.c index 559d09b..84d98e2 100644 --- a/lib/ykpiv.c +++ b/lib/ykpiv.c @@ -134,7 +134,7 @@ int _ykpiv_set_length(unsigned char *buffer, size_t length) { if(length < 0x80) { *buffer++ = (unsigned char)length; return 1; - } else if(length < 0xff) { + } else if(length < 0x100) { *buffer++ = 0x81; *buffer++ = (unsigned char)length; return 2;