瀏覽代碼

Make sure the integer passed to --result-fd is correct before manipulating
the pointers(we checked after we manipulated previously)

Adam Heath 25 年之前
父節點
當前提交
731952425e
共有 2 個文件被更改,包括 9 次插入3 次删除
  1. 6 0
      ChangeLog
  2. 3 3
      main/main.c

+ 6 - 0
ChangeLog

@@ -1,3 +1,9 @@
+Mon Oct  8 19:48:28 CDT 2001 Adam Heath <doogie@debian.org>
+
+  * 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 <doogie@debian.org>
 
   * Makefile.in: Remove dulicate inclusion of utils in SUBDIRS.

+ 3 - 3
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;
 }