summaryrefslogtreecommitdiffstats
path: root/tools/gpgconf-comp.c
diff options
context:
space:
mode:
authorJustus Winter <justus@g10code.com>2017-03-01 17:47:47 +0100
committerJustus Winter <justus@g10code.com>2017-03-02 09:31:11 +0100
commite064c75b08a523f738108428fe0c417a46e66238 (patch)
tree114eadbf50dcfbdd6b86c7c50cf255c585348fec /tools/gpgconf-comp.c
parentPost release updates. (diff)
downloadgnupg2-e064c75b08a523f738108428fe0c417a46e66238.tar.xz
gnupg2-e064c75b08a523f738108428fe0c417a46e66238.zip
common,tools: Always escape newlines when escaping data.
* common/stringhelp.c (do_percent_escape): Always escape newlines. * tools/gpgconf-comp.c (gc_percent_escape): Likewise. -- Newlines always pose a problem for a line-based communication format. GnuPG-bug-id: 2387 Signed-off-by: Justus Winter <justus@g10code.com>
Diffstat (limited to 'tools/gpgconf-comp.c')
-rw-r--r--tools/gpgconf-comp.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/tools/gpgconf-comp.c b/tools/gpgconf-comp.c
index d53947e7f..0c939e5e0 100644
--- a/tools/gpgconf-comp.c
+++ b/tools/gpgconf-comp.c
@@ -1491,6 +1491,13 @@ gc_percent_escape (const char *src)
*(dst++) = '2';
*(dst++) = 'c';
}
+ else if (*src == '\n')
+ {
+ /* The newline is problematic in a line-based format. */
+ *(dst++) = '%';
+ *(dst++) = '0';
+ *(dst++) = 'a';
+ }
else
*(dst++) = *(src);
src++;