1
0
mirror of git://git.gnupg.org/gnupg.git synced 2024-12-22 10:19:57 +01:00

agent: Fix regression in agent_get_shadow_info_type.

* agent/protect.c (agent_get_shadow_info_type): Return the correct
value.
--

Fixes-commit: 33a2362e566c0e0d7011abf2e5fa5704d7cb4206
GnuPG-bug-id: 5393
This commit is contained in:
Werner Koch 2021-06-25 20:23:01 +02:00
parent 9579c77862
commit a6efde307f
No known key found for this signature in database
GPG Key ID: E3FDFF218E45B72B

View File

@ -1610,8 +1610,8 @@ agent_get_shadow_info_type (const unsigned char *shadowkey,
unsigned char const **shadow_info, unsigned char const **shadow_info,
unsigned char **shadow_type) unsigned char **shadow_type)
{ {
const unsigned char *s; const unsigned char *s, *saved_s;
size_t n; size_t n, saved_n;
int depth = 0; int depth = 0;
s = shadowkey; s = shadowkey;
@ -1660,6 +1660,8 @@ agent_get_shadow_info_type (const unsigned char *shadowkey,
n = snext (&s); n = snext (&s);
if (!n) if (!n)
return gpg_error (GPG_ERR_INV_SEXP); return gpg_error (GPG_ERR_INV_SEXP);
saved_s = s;
saved_n = n;
if (smatch (&s, n, "t1-v1") || smatch(&s, n, "tpm2-v1")) if (smatch (&s, n, "t1-v1") || smatch(&s, n, "tpm2-v1"))
{ {
if (*s != '(') if (*s != '(')
@ -1669,6 +1671,8 @@ agent_get_shadow_info_type (const unsigned char *shadowkey,
} }
else else
return gpg_error (GPG_ERR_UNSUPPORTED_PROTOCOL); return gpg_error (GPG_ERR_UNSUPPORTED_PROTOCOL);
s = saved_s;
n = saved_n;
if (shadow_type) if (shadow_type)
{ {