From 8efe738c4a090f523461fa3055da668467715105 Mon Sep 17 00:00:00 2001 From: Werner Koch Date: Fri, 6 May 2022 11:35:02 +0200 Subject: [PATCH] scd:p15: Fix the the sanity check of the displayed S/N. * scd/app-p15.c (any_control_or_space): Fix loop. -- This check is only done to avoid printing wrongly encoded S/N for human consumption. e --- scd/app-p15.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/scd/app-p15.c b/scd/app-p15.c index 404a01b82..8ede6c05e 100644 --- a/scd/app-p15.c +++ b/scd/app-p15.c @@ -481,7 +481,7 @@ struct app_local_s unsigned short auth_objects; } odf; - /* The PKCS#15 serialnumber from EF(TokeiNFo) or NULL. Malloced. */ + /* The PKCS#15 serialnumber from EF(TokenInfo) or NULL. Malloced. */ unsigned char *serialno; size_t serialnolen; @@ -4999,7 +4999,11 @@ any_control_or_space (const char *string) { const unsigned char *s; - for (s = string; *string; string++) + for (s = string; *s; s++) + if (*s <= 0x20 || *s >= 0x7f) + return 1; + return 0; +} if (*s <= 0x20 || *s >= 0x7f) return 1; return 0;