mirror of
git://git.gnupg.org/gnupg.git
synced 2025-01-22 14:57:02 +01:00
agent: Avoid double free of empty string in the PIN caching.
* agent/call-scd.c (handle_pincache_get): Set PIN to NULL. Also add DBG_CACHE conditionals and don't return the pin in the debug output. -- This is part of GnuPG-bug-id: 7129 Co-authored-by: Jakub Jelen <jjelen@redhat.com> (cherry picked from commit bdbf5cee2ff5bc0773011abde4074003ef9dac70)
This commit is contained in:
parent
19d93a239d
commit
5e7ea64305
@ -196,7 +196,8 @@ handle_pincache_get (const char *args, assuan_context_t ctx)
|
|||||||
const char *key;
|
const char *key;
|
||||||
char *pin = NULL;
|
char *pin = NULL;
|
||||||
|
|
||||||
log_debug ("%s: enter '%s'\n", __func__, args);
|
if (DBG_CACHE)
|
||||||
|
log_debug ("%s: enter '%s'\n", __func__, args);
|
||||||
key = args;
|
key = args;
|
||||||
if (strlen (key) < 5)
|
if (strlen (key) < 5)
|
||||||
{
|
{
|
||||||
@ -210,11 +211,14 @@ handle_pincache_get (const char *args, assuan_context_t ctx)
|
|||||||
if (!pin || !*pin)
|
if (!pin || !*pin)
|
||||||
{
|
{
|
||||||
xfree (pin);
|
xfree (pin);
|
||||||
|
pin = NULL;
|
||||||
err = 0; /* Not found is indicated by sending no data back. */
|
err = 0; /* Not found is indicated by sending no data back. */
|
||||||
log_debug ("%s: not cached\n", __func__);
|
if (DBG_CACHE)
|
||||||
|
log_debug ("%s: not cached\n", __func__);
|
||||||
goto leave;
|
goto leave;
|
||||||
}
|
}
|
||||||
log_debug ("%s: cache returned '%s'\n", __func__, pin);
|
if (DBG_CACHE)
|
||||||
|
log_debug ("%s: cache returned '%s'\n", __func__, "[hidden]"/*pin*/);
|
||||||
err = assuan_send_data (ctx, pin, strlen (pin));
|
err = assuan_send_data (ctx, pin, strlen (pin));
|
||||||
|
|
||||||
leave:
|
leave:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user