[Reproducible-commits] [dpkg] 12/30: libdpkg: Do not use fixed size buffers in options module

Mattia Rizzolo mattia at debian.org
Mon May 9 09:02:51 UTC 2016


This is an automated email from the git hooks/post-receive script.

mattia pushed a commit to branch pu/reproducible_builds
in repository dpkg.

commit 5982d9503c425d4435d542947632a4c7c2646005
Author: Guillem Jover <guillem at debian.org>
Date:   Fri May 6 01:20:16 2016 +0200

    libdpkg: Do not use fixed size buffers in options module
---
 debian/changelog   | 1 +
 lib/dpkg/options.c | 8 ++++----
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 24a203d..e2185ca 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -10,6 +10,7 @@ dpkg (1.18.7) UNRELEASED; urgency=medium
     allocated formatted strings instead:
     - In start-stop-daemon to report what to stop.
     - In dselect to print main and access methods menu entries.
+    - In libdpkg command-line option parsing errors.
   * Perl modules:
     - Relax dependency restrictions parsing to allow again sloppy spaces
       around versions, architectures and profile restrictions.
diff --git a/lib/dpkg/options.c b/lib/dpkg/options.c
index 62d4aca..2bcb766 100644
--- a/lib/dpkg/options.c
+++ b/lib/dpkg/options.c
@@ -41,11 +41,11 @@ static const char *printforhelp;
 void
 badusage(const char *fmt, ...)
 {
-  char buf[1024];
+  char *buf = NULL;
   va_list args;
 
   va_start(args, fmt);
-  vsnprintf(buf, sizeof(buf), fmt, args);
+  m_vasprintf(&buf, fmt, args);
   va_end(args);
 
   ohshit("%s\n\n%s", buf, gettext(printforhelp));
@@ -54,11 +54,11 @@ badusage(const char *fmt, ...)
 static void DPKG_ATTR_NORET DPKG_ATTR_PRINTF(3)
 config_error(const char *file_name, int line_num, const char *fmt, ...)
 {
-  char buf[1024];
+  char *buf = NULL;
   va_list args;
 
   va_start(args, fmt);
-  vsnprintf(buf, sizeof(buf), fmt, args);
+  m_vasprintf(&buf, fmt, args);
   va_end(args);
 
   ohshit(_("configuration error: %s:%d: %s"), file_name, line_num, buf);

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/reproducible/dpkg.git



More information about the Reproducible-commits mailing list