aboutsummaryrefslogtreecommitdiffstats
path: root/common/membuf.c
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>2009-04-01 10:51:53 +0000
committerWerner Koch <[email protected]>2009-04-01 10:51:53 +0000
commitf8b4cd76501824d56d3cf78a8ba85291a62f0e6d (patch)
treecec902ba7d3dd1a38846805cf491a65b95bb79cd /common/membuf.c
parentImplement decryption for TCOS 3 cards. (diff)
downloadgnupg-f8b4cd76501824d56d3cf78a8ba85291a62f0e6d.tar.gz
gnupg-f8b4cd76501824d56d3cf78a8ba85291a62f0e6d.zip
Import/export of pkcs#12 now uses the gpg-agent directly.
Removed duplicated code (percent unescaping).
Diffstat (limited to 'common/membuf.c')
-rw-r--r--common/membuf.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/common/membuf.c b/common/membuf.c
index 9395eab6d..737930b76 100644
--- a/common/membuf.c
+++ b/common/membuf.c
@@ -1,5 +1,5 @@
-/* membuf.c - A simple implementation of a dynamic buffer
- * Copyright (C) 2001, 2003 Free Software Foundation, Inc.
+/* membuf.c - A simple implementation of a dynamic buffer.
+ * Copyright (C) 2001, 2003, 2009 Free Software Foundation, Inc.
*
* This file is part of GnuPG.
*
@@ -75,7 +75,7 @@ put_membuf (membuf_t *mb, const void *buf, size_t len)
in case we are storing sensitive data here. The membuf
API does not provide another way to cleanup after an
error. */
- memset (mb->buf, 0, mb->len);
+ wipememory (mb->buf, mb->len);
return;
}
mb->buf = p;
@@ -99,8 +99,12 @@ get_membuf (membuf_t *mb, size_t *len)
if (mb->out_of_core)
{
- xfree (mb->buf);
- mb->buf = NULL;
+ if (mb->buf)
+ {
+ wipememory (mb->buf, mb->len);
+ xfree (mb->buf);
+ mb->buf = NULL;
+ }
errno = mb->out_of_core;
return NULL;
}