Przeglądaj źródła

libdpkg: Do not crash if we pass a NULL cip argument to setaction()

Guillem Jover 10 lat temu
rodzic
commit
25da5c5970
2 zmienionych plików z 2 dodań i 1 usunięć
  1. 1 0
      debian/changelog
  2. 1 1
      lib/dpkg/options.c

+ 1 - 0
debian/changelog

@@ -21,6 +21,7 @@ dpkg (1.18.11) UNRELEASED; urgency=medium
   * Switch from non-freeing malloc to m_malloc for invoke hooks.
   * Switch from non-freeing malloc to m_malloc for invoke hooks.
   * Always reset the package in-core database when shutting down the package
   * Always reset the package in-core database when shutting down the package
     database journal.
     database journal.
+  * Do not crash if we pass a NULL cip argument to setaction() in libdpkg.
   * Perl modules:
   * Perl modules:
     - Obsolete Source-Version substvar in Dpkg::Substvars by emitting errors.
     - Obsolete Source-Version substvar in Dpkg::Substvars by emitting errors.
     - Rework keyring hooks in Dpkg::Vendor. Deprecate the keyrings hook, and
     - Rework keyring hooks in Dpkg::Vendor. Deprecate the keyrings hook, and

+ 1 - 1
lib/dpkg/options.c

@@ -315,7 +315,7 @@ option_short(int c)
 void
 void
 setaction(const struct cmdinfo *cip, const char *value)
 setaction(const struct cmdinfo *cip, const char *value)
 {
 {
-  if (cipaction)
+  if (cipaction && cip)
     badusage(_("conflicting actions -%c (--%s) and -%c (--%s)"),
     badusage(_("conflicting actions -%c (--%s) and -%c (--%s)"),
              option_short(cip->oshort), cip->olong,
              option_short(cip->oshort), cip->olong,
              option_short(cipaction->oshort), cipaction->olong);
              option_short(cipaction->oshort), cipaction->olong);