DAP v3.0 Core Dump

Marty Morrison <[email protected]>
Newsgroups gmane.comp.statistics.dap.bugs
Message-ID <657579C6E28A4E4A8407B39249BE177E0AEE59@honts3003.homeoffice.wal-mart.com>
Dap v3.0 -- Core Dump


The "dap" program assumes that it will be called with the correct
command-line arguments.  Specifically, if you enter a command such as "dap
--version" you will get a core-dump.  This is because the edrun() routine
assumes that it will always be passed a filename argument that does not
begin with "-".  This is not a good assumption!

This can be corrected by adding a check for number of passed arguments in
two places in the edrun() routine:
-----------------------------------------------------------------------
The first for() loop in dap.c (line 136) should be changed from this

    for (argstart = 1; argv[argstart][0] == '-'; argstart++)
      ;

to this

    for (argstart = 1; argstart < argc && argv[argstart][0] == '-';
argstart++)
      ;
-----------------------------------------------------------------------
Secondly, the value of argstart should be compared against argc following
that for() loop with new code added similar to the following (starting at
about line 138)

    if (argstart >= argc)
     {
       fputs("dap: no files to process\n", stderr);
       exit(1);
     }
-----------------------------------------------------------------------


Marty Morrison
[email protected]
(479) 277-3428




**********************************************************************
This email and any files transmitted with it are confidential
and intended solely for the individual or entity to 
whom they are addressed.  If you have received this email
in error destroy it immediately.
**********************************************************************
             Wal-Mart Stores, Inc. Confidential
**********************************************************************
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.