mirror of
git://git.gnupg.org/gnupg.git
synced 2025-04-17 15:44:34 +02:00
* app-openpgp.c (get_cached_data): Avoid mallocing zero since it breaks us
when using --enable-m-guard.
This commit is contained in:
parent
b700d3cd3e
commit
dccd0d991b
@ -1,5 +1,8 @@
|
|||||||
2004-09-10 David Shaw <dshaw@jabberwocky.com>
|
2004-09-10 David Shaw <dshaw@jabberwocky.com>
|
||||||
|
|
||||||
|
* app-openpgp.c (get_cached_data): Avoid mallocing zero since it
|
||||||
|
breaks us when using --enable-m-guard.
|
||||||
|
|
||||||
* ccid-driver.c (read_device_info): Fix segfault when usb device
|
* ccid-driver.c (read_device_info): Fix segfault when usb device
|
||||||
is not accessible.
|
is not accessible.
|
||||||
(ccid_open_reader): Allow working with an even older version of
|
(ccid_open_reader): Allow working with an even older version of
|
||||||
|
@ -124,7 +124,6 @@ get_cached_data (app_t app, int tag,
|
|||||||
size_t len;
|
size_t len;
|
||||||
struct cache_s *c;
|
struct cache_s *c;
|
||||||
|
|
||||||
|
|
||||||
*result = NULL;
|
*result = NULL;
|
||||||
*resultlen = 0;
|
*resultlen = 0;
|
||||||
|
|
||||||
@ -133,13 +132,18 @@ get_cached_data (app_t app, int tag,
|
|||||||
for (c=app->app_local->cache; c; c = c->next)
|
for (c=app->app_local->cache; c; c = c->next)
|
||||||
if (c->tag == tag)
|
if (c->tag == tag)
|
||||||
{
|
{
|
||||||
p = xtrymalloc (c->length);
|
if(c->length)
|
||||||
if (!p)
|
{
|
||||||
return gpg_error (gpg_err_code_from_errno (errno));
|
p = xtrymalloc (c->length);
|
||||||
memcpy (p, c->data, c->length);
|
if (!p)
|
||||||
*resultlen = c->length;
|
return gpg_error (gpg_err_code_from_errno (errno));
|
||||||
*result = p;
|
memcpy (p, c->data, c->length);
|
||||||
return 0;
|
*result = p;
|
||||||
|
}
|
||||||
|
|
||||||
|
*resultlen = c->length;
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user