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 <gniibe@fsij.org>
This commit is contained in:
NIIBE Yutaka 2022-09-07 11:27:32 +09:00
parent 1522813888
commit 80670f60ba

View File

@ -129,7 +129,7 @@ parse_import (char *args, gpgme_import_status_t *import_status, int problem)
gpg_err_set_errno (0); gpg_err_set_errno (0);
nr = strtol (args, &tail, 0); nr = strtol (args, &tail, 0);
if (errno || args == tail || *tail != ' ') if (errno || args == tail)
{ {
/* The crypto backend does not behave. */ /* The crypto backend does not behave. */
free (import); free (import);
@ -173,12 +173,17 @@ parse_import (char *args, gpgme_import_status_t *import_status, int problem)
if (tail) if (tail)
*tail = '\0'; *tail = '\0';
import->fpr = strdup (args); if (*args)
if (!import->fpr)
{ {
free (import); import->fpr = strdup (args);
return gpg_error_from_syserror (); if (!import->fpr)
{
free (import);
return gpg_error_from_syserror ();
}
} }
else
import->fpr = NULL;
*import_status = import; *import_status = import;
return 0; return 0;