From b8b49c11e95fd978a8a2eed23f191d087ab056da Mon Sep 17 00:00:00 2001 From: Werner Koch Date: Thu, 25 Nov 2021 11:48:11 +0100 Subject: [PATCH] core: Make the gpgconf option parsing of string types more robust * src/engine-gpgconf.c (gpgconf_parse_option): Skip the string indicator if it is not the empty string. -- Some versions of GnuPG (~2.2.28 to 2.2.33) returned a compliance indicator which should be an int but actually used string as type. Simply skipping the indicator without checking that this is the indicator does not allow to work around this type mismatch by the gpgme users. --- src/engine-gpgconf.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/engine-gpgconf.c b/src/engine-gpgconf.c index 28f91158..caf4d789 100644 --- a/src/engine-gpgconf.c +++ b/src/engine-gpgconf.c @@ -445,8 +445,10 @@ gpgconf_parse_option (gpgme_conf_opt_t opt, case GPGME_CONF_PUB_KEY: case GPGME_CONF_SEC_KEY: case GPGME_CONF_ALIAS_LIST: - /* Skip quote character. */ - line++; + /* Skip quote character. It is required by specs but + * technically not always needed. */ + if (*line == '\"' && line[1]) + line++; err = _gpgme_decode_percent_string (line, &arg->value.string, 0, 0);