From 84282a95388cdcf7ad4595f4777e8dba0da81ca6 Mon Sep 17 00:00:00 2001 From: Werner Koch Date: Tue, 15 Feb 2005 16:23:45 +0000 Subject: (modify_description): Don't increment OUT_LEN during the second pass. --- agent/findkey.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'agent/findkey.c') 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++; } } -- cgit v1.2.3