summaryrefslogtreecommitdiffstats
path: root/agent
diff options
context:
space:
mode:
authorWerner Koch <wk@gnupg.org>2005-02-15 17:23:45 +0100
committerWerner Koch <wk@gnupg.org>2005-02-15 17:23:45 +0100
commit84282a95388cdcf7ad4595f4777e8dba0da81ca6 (patch)
treeb483c14072c2d846bd27fd23fd52046734422d2d /agent
parent2005-02-14 Moritz Schulte <moritz@g10code.com> (diff)
downloadgnupg2-84282a95388cdcf7ad4595f4777e8dba0da81ca6.tar.xz
gnupg2-84282a95388cdcf7ad4595f4777e8dba0da81ca6.zip
(modify_description): Don't increment OUT_LEN during
the second pass.
Diffstat (limited to 'agent')
-rw-r--r--agent/ChangeLog5
-rw-r--r--agent/findkey.c11
2 files changed, 12 insertions, 4 deletions
diff --git a/agent/ChangeLog b/agent/ChangeLog
index 7eb73e013..f0e19ad37 100644
--- a/agent/ChangeLog
+++ b/agent/ChangeLog
@@ -1,3 +1,8 @@
+2005-02-15 Werner Koch <wk@g10code.com>
+
+ * findkey.c (modify_description): Don't increment OUT_LEN during
+ the second pass.
+
2005-02-14 Moritz Schulte <moritz@g10code.com>
* command-ssh.c (es_read_byte): Renamed to ...
diff --git a/agent/findkey.c b/agent/findkey.c
index 896cb880e..1ac57ad07 100644
--- a/agent/findkey.c
+++ b/agent/findkey.c
@@ -179,18 +179,20 @@ modify_description (const char *in, const char *comment, char **result)
switch (in[i])
{
case '%':
- out_len++;
if (out)
*out++ = '%';
+ else
+ out_len++;
break;
case 'c': /* Comment. */
- out_len += comment_length;
- if (out && comment_length)
+ if (out)
{
memcpy (out, comment, comment_length);
out += comment_length;
}
+ else
+ out_len += comment_length;
break;
default: /* Invalid special sequences are ignored. */
@@ -199,9 +201,10 @@ modify_description (const char *in, const char *comment, char **result)
}
else
{
- out_len++;
if (out)
*out++ = in[i];
+ else
+ out_len++;
}
}