mirror of
git://git.gnupg.org/gnupg.git
synced 2025-01-21 14:47:03 +01:00
scd: Fix handling for Data Object with no data.
* scd/app-openpgp.c (get_cached_data): Return NULL for Data Object with no data. -- When GET_DATA returns no data with success (90 00), this routine firstly returned buffer with length zero, and secondly (with cache) returned NULL, which is inconsistent. Now, it returns NULL for both cases. Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
This commit is contained in:
parent
e0658b19d9
commit
0a3bec2c25
@ -348,7 +348,8 @@ get_cached_data (app_t app, int tag,
|
||||
err = iso7816_get_data (app->slot, exmode, tag, &p, &len);
|
||||
if (err)
|
||||
return err;
|
||||
*result = p;
|
||||
if (len)
|
||||
*result = p;
|
||||
*resultlen = len;
|
||||
|
||||
/* Check whether we should cache this object. */
|
||||
@ -370,7 +371,10 @@ get_cached_data (app_t app, int tag,
|
||||
c = xtrymalloc (sizeof *c + len);
|
||||
if (c)
|
||||
{
|
||||
memcpy (c->data, p, len);
|
||||
if (len)
|
||||
memcpy (c->data, p, len);
|
||||
else
|
||||
xfree (p);
|
||||
c->length = len;
|
||||
c->tag = tag;
|
||||
c->next = app->app_local->cache;
|
||||
|
Loading…
x
Reference in New Issue
Block a user