From b27f0d42f9528e20b09a2bb4171073531ed415ae Mon Sep 17 00:00:00 2001 From: Richard Hughes Date: Fri, 7 Feb 2020 13:44:26 +0000 Subject: [PATCH] tpm: Optimize the string parsing and fix the boolean logic The g_ascii_isgraph() correctly handles NUL so just remove the check rather than adding brackets around the logic. --- plugins/tpm/fu-tpm-device.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/tpm/fu-tpm-device.c b/plugins/tpm/fu-tpm-device.c index 05ad1ba54..8c31beb29 100644 --- a/plugins/tpm/fu-tpm-device.c +++ b/plugins/tpm/fu-tpm-device.c @@ -75,7 +75,7 @@ fu_tpm_device_get_string (ESYS_CONTEXT *ctx, guint32 query, GError **error) /* convert non-ASCII into spaces */ for (guint i = 0; i < 4; i++) { - if (!g_ascii_isgraph (result[i]) && result[i] != '\0') + if (!g_ascii_isgraph (result[i])) result[i] = 0x20; }