aboutsummaryrefslogtreecommitdiffstats
path: root/g10/cpr.c
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>2017-11-23 14:12:45 +0000
committerWerner Koch <[email protected]>2017-11-23 14:12:45 +0000
commitfe96ca8d86881a611816a6de4047f00c69325ea5 (patch)
tree6d4a31ad49c34010b117dc5db7575877225ddb1b /g10/cpr.c
parentdoc: clarify that --encrypt refers to public key encryption (diff)
parentbuild: Update distsigkey.gpg (diff)
downloadgnupg-fe96ca8d86881a611816a6de4047f00c69325ea5.tar.gz
gnupg-fe96ca8d86881a611816a6de4047f00c69325ea5.zip
Merge branch 'STABLE-BRANCH-2-2'
-- Signed-off-by: Werner Koch <[email protected]>
Diffstat (limited to 'g10/cpr.c')
-rw-r--r--g10/cpr.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/g10/cpr.c b/g10/cpr.c
index 154872013..a7fd1aaba 100644
--- a/g10/cpr.c
+++ b/g10/cpr.c
@@ -425,11 +425,17 @@ do_get_from_fd ( const char *keyword, int hidden, int getbool )
{
if (i >= len-1 )
{
+ /* On the first iteration allocate a new buffer. If that
+ * buffer is too short at further iterations do a poor man's
+ * realloc. */
char *save = string;
len += 100;
string = hidden? xmalloc_secure ( len ) : xmalloc ( len );
if (save)
- memcpy (string, save, i );
+ {
+ memcpy (string, save, i);
+ xfree (save);
+ }
else
i = 0;
}