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 /g10/app-openpgp.c | |
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 'g10/app-openpgp.c')
-rw-r--r-- | g10/app-openpgp.c | 20 |
1 files changed, 12 insertions, 8 deletions
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; } } |