From: Adam Heath Date: Tue, 9 Oct 2001 00:50:07 +0000 (+0000) Subject: Make sure the integer passed to --result-fd is correct before manipulating X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=731952425e05d536062b4490b26bb99a6ad0e019;p=dpkg Make sure the integer passed to --result-fd is correct before manipulating the pointers(we checked after we manipulated previously) --- diff --git a/ChangeLog b/ChangeLog index d7c61d30..4f417f1f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +Mon Oct 8 19:48:28 CDT 2001 Adam Heath + + * main/main.c: Make sure the integer passed to --result-fd is correct + before manipulating the pointers(we checked after we manipulated + previously) + Sun Oct 7 22:23:54 CDT 2001 Adam Heath * Makefile.in: Remove dulicate inclusion of utils in SUBDIRS. diff --git a/main/main.c b/main/main.c index a4c8b4e8..872d8006 100644 --- a/main/main.c +++ b/main/main.c @@ -270,15 +270,15 @@ static void setstatuspipe(const struct cmdinfo *cip, const char *value) { unsigned long v; char *ep; + v= strtoul(value,&ep,0); + if (*ep || v > INT_MAX) + badusage(_("invalid integer for --%s: `%.250s'"),cip->olong,value); if (lastpipe) { lastpipe->next= nfmalloc(sizeof(struct pipef)); lastpipe= lastpipe->next; } else { lastpipe= status_pipes= nfmalloc(sizeof(struct pipef)); } - v= strtoul(value,&ep,0); - if (*ep || v > INT_MAX) - badusage(_("invalid integer for --%s: `%.250s'"),cip->olong,value); lastpipe->fd= v; }