From e064c75b08a523f738108428fe0c417a46e66238 Mon Sep 17 00:00:00 2001 From: Justus Winter Date: Wed, 1 Mar 2017 17:47:47 +0100 Subject: 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 --- tools/gpgconf-comp.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'tools') 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++; -- cgit v1.2.3