chiark / gitweb /
common,tools: Always escape newlines when escaping data.
[gnupg2.git] / tools / gpgconf-comp.c
index 530c1287f2b7b8bc837d5ee50f0a856559273f48..9358e2efac0d4fd943973517481c9d58012fbd9c 100644 (file)
@@ -1490,6 +1490,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++;