The following commit has been merged in the master branch:
commit db9645cff36a3fff3c597764fb8d49fbc819bad7
Author: Guillem Jover <[email protected]>
Date:   Thu Nov 20 06:03:57 2008 +0200

    Sanitize --status-fd output by replacing newlines with spaces
    
    Closes: #505172

diff --git a/ChangeLog b/ChangeLog
index 341a01a..43273c8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 2009-01-22  Guillem Jover  <[email protected]>
 
+       * lib/log.c (statusfd_send): Use varbufsubstc to replace new lines
+       with spaces.
+
+2009-01-22  Guillem Jover  <[email protected]>
+
        * lib/dpkg-db.h (varbufsubstc): New function prototype.
        * lib/varbuf.c (varbufsubstc): New function definition.
        * lib/test/t-varbuf.c (test_varbuf_substc): New function.
diff --git a/debian/changelog b/debian/changelog
index 716876b..3658d94 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -53,6 +53,8 @@ dpkg (1.15.0) UNRELEASED; urgency=low
   * Add new option --procsched to start-stop-daemon to be able to set the
     process scheduling policy and priority. Closes: #175740
   * Add initial C unit test suite for libdpkg.
+  * Sanitize --status-fd output by replacing newlines with spaces.
+    Closes: #505172
 
   [ Raphael Hertzog ]
   * Enhance dpkg-shlibdeps's error message when a library can't be found to
diff --git a/lib/log.c b/lib/log.c
index 6852931..bfd5177 100644
--- a/lib/log.c
+++ b/lib/log.c
@@ -89,6 +89,9 @@ statusfd_send(const char *fmt, ...)
        va_start(al, fmt);
        varbufreset(&vb);
        varbufvprintf(&vb, fmt, al);
+       /* Sanitize string to not include new lines, as front-ends should be
+        * doing their own word-wrapping. */
+       varbufsubstc(&vb, '\n', ' ');
        varbufaddc(&vb, '\n');
        va_end(al);
 

-- 
dpkg's main repository


-- 
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]

Reply via email to