diff options
author | David Shaw <[email protected]> | 2004-09-11 03:30:48 +0000 |
---|---|---|
committer | David Shaw <[email protected]> | 2004-09-11 03:30:48 +0000 |
commit | dccd0d991bdbf82c5cdd5d8d322c1ab01d5aa249 (patch) | |
tree | c4a5cca2c1979696157599297399c267463b2183 | |
parent | * NEWS: Note HTTP basic auth. (diff) | |
download | gnupg-dccd0d991bdbf82c5cdd5d8d322c1ab01d5aa249.tar.gz gnupg-dccd0d991bdbf82c5cdd5d8d322c1ab01d5aa249.zip |
* app-openpgp.c (get_cached_data): Avoid mallocing zero since it breaks us
when using --enable-m-guard.
Diffstat (limited to '')
-rw-r--r-- | g10/ChangeLog | 3 | ||||
-rw-r--r-- | g10/app-openpgp.c | 20 |
2 files changed, 15 insertions, 8 deletions
diff --git a/g10/ChangeLog b/g10/ChangeLog index 6696c0a69..b042800f3 100644 --- a/g10/ChangeLog +++ b/g10/ChangeLog @@ -1,5 +1,8 @@ 2004-09-10 David Shaw <[email protected]> + * 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 diff --git a/g10/app-openpgp.c b/g10/app-openpgp.c index 3dc015baa..ba34aca04 100644 --- a/g10/app-openpgp.c +++ b/g10/app-openpgp.c @@ -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; } } |