tags 386197 patch quit On Tue, Sep 05, 2006 at 03:30:56PM -0400, Justin Pryzby wrote: > Package: dpkg > Version: 1.13.21 > Severity: normal > > $ sudo dpkg --abort-after '' -i / > dpkg-split: error reading /: Is a directory > dpkg: error processing / (--install): > subprocess dpkg-split returned error exit status 2 > dpkg: too many errors, stopping > Errors were encountered while processing: > / > Processing was halted because there were too many errors. > > This is easy to fix by checking (s==end), or by setting errno=0 before > calling strto* functions, and checking (errno!=0) afterwards (see the > recently-updated manpage example). Given enough time, I will > eventually provide a patch for this, but I don't know that I'll get to > it anytime soon..
The attached patch should fix that and is conformant with man strtoul: In particular, if *nptr is not '\0' but **endptr is '\0' on return, the entire string is valid. Cheers, -- Bill. <ballo...@debian.org> Imagine a large red swirl here.
diff --git a/src/main.c b/src/main.c index c892af3..ca1ba25 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; }