Browse Source

Sanitize --status-fd output by replacing newlines with spaces

Closes: #505172
Guillem Jover 15 years ago
parent
commit
db9645cff3
3 changed files with 10 additions and 0 deletions
  1. 5 0
      ChangeLog
  2. 2 0
      debian/changelog
  3. 3 0
      lib/log.c

+ 5 - 0
ChangeLog

@@ -1,3 +1,8 @@
+2009-01-22  Guillem Jover  <guillem@debian.org>
+
+	* lib/log.c (statusfd_send): Use varbufsubstc to replace new lines
+	with spaces.
+
 2009-01-22  Guillem Jover  <guillem@debian.org>
 
 	* lib/dpkg-db.h (varbufsubstc): New function prototype.

+ 2 - 0
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

+ 3 - 0
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);