From 80670f60ba971145dd6792e00d31c08c10cc8159 Mon Sep 17 00:00:00 2001 From: NIIBE Yutaka Date: Wed, 7 Sep 2022 11:27:32 +0900 Subject: [PATCH] Fix parsing import status for invalid fingerprint. * src/import.c (parse_import): Handle invalid fingerprint case. -- GnuPG-bug-id: 6187 Signed-off-by: NIIBE Yutaka --- src/import.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/import.c b/src/import.c index cd9f960f..f46313c7 100644 --- a/src/import.c +++ b/src/import.c @@ -129,7 +129,7 @@ parse_import (char *args, gpgme_import_status_t *import_status, int problem) gpg_err_set_errno (0); nr = strtol (args, &tail, 0); - if (errno || args == tail || *tail != ' ') + if (errno || args == tail) { /* The crypto backend does not behave. */ free (import); @@ -173,12 +173,17 @@ parse_import (char *args, gpgme_import_status_t *import_status, int problem) if (tail) *tail = '\0'; - import->fpr = strdup (args); - if (!import->fpr) + if (*args) { - free (import); - return gpg_error_from_syserror (); + import->fpr = strdup (args); + if (!import->fpr) + { + free (import); + return gpg_error_from_syserror (); + } } + else + import->fpr = NULL; *import_status = import; return 0;