1
0
mirror of git://git.gnupg.org/gnupg.git synced 2025-03-12 23:01:14 +01:00

* app-openpgp.c (get_cached_data): Avoid mallocing zero since it breaks us

when using --enable-m-guard.
This commit is contained in:
David Shaw 2004-09-11 03:30:48 +00:00
parent b700d3cd3e
commit dccd0d991b
2 changed files with 15 additions and 8 deletions

View File

@ -1,5 +1,8 @@
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
is not accessible.
(ccid_open_reader): Allow working with an even older version of

View File

@ -124,7 +124,6 @@ get_cached_data (app_t app, int tag,
size_t len;
struct cache_s *c;
*result = NULL;
*resultlen = 0;
@ -133,13 +132,18 @@ get_cached_data (app_t app, int tag,
for (c=app->app_local->cache; c; c = c->next)
if (c->tag == tag)
{
p = xtrymalloc (c->length);
if (!p)
return gpg_error (gpg_err_code_from_errno (errno));
memcpy (p, c->data, c->length);
*resultlen = c->length;
*result = p;
return 0;
if(c->length)
{
p = xtrymalloc (c->length);
if (!p)
return gpg_error (gpg_err_code_from_errno (errno));
memcpy (p, c->data, c->length);
*result = p;
}
*resultlen = c->length;
return 0;
}
}