The following commit has been merged in the master branch:
commit d80d6958a20f3664b7bb0ef49f5fe5b8056836e6
Author: Raphael Hertzog <[email protected]>
Date:   Sun Mar 22 11:45:10 2009 +0100

    dpkg: refuses empty parameters when integer expected
    
    Fix setinteger() funtion used for parsing integer options to
    refuse empty parameters. Currently only affects --abort-after.
    
    Based-on-patch-by: Bill Allombert <[email protected]>

diff --git a/THANKS b/THANKS
index 9f93f22..22a803b 100644
--- a/THANKS
+++ b/THANKS
@@ -17,6 +17,7 @@ Bart Martens <[email protected]>
 Bastian Kleineidam <[email protected]>
 Ben Collins <[email protected]>
 Ben Pfaff <[email protected]>
+Bill Allombert <[email protected]>
 Branden Robinson <[email protected]>
 Branko Lankester
 Brian M. Carlson <[email protected]>
diff --git a/debian/changelog b/debian/changelog
index c4555f2..5b07f20 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -43,6 +43,8 @@ dpkg (1.15.1) UNRELEASED; urgency=low
     arguments starting with a dash are not interpreted as options.
     Closes: #293163
     Thanks to Bill Allombert for the patch.
+  * dpkg now correctly refuses empty parameters when an integer value is
+    wanted. Closes: #386197 Based on a patch by Bill Allombert.
 
   [ Guillem Jover ]
   * Fix typo in dpkg output (‘unexecpted’ → ‘unexpected’). Closes: #519082
diff --git a/src/main.c b/src/main.c
index 3debe13..d45de7e 100644
--- a/src/main.c
+++ b/src/main.c
@@ -293,7 +293,7 @@ static void setinteger(const struct cmdinfo *cip, const 
char *value) {
   char *ep;
 
   v= strtoul(value,&ep,0);
-  if (*ep || v > INT_MAX)
+  if (!*value || *ep || v > INT_MAX)
     badusage(_("invalid integer for --%s: `%.250s'"),cip->olong,value);
   *cip->iassignto= v;
 }

-- 
dpkg's main repository


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

Reply via email to