nkaul / pdsh

Automatically exported from code.google.com/p/pdsh
GNU General Public License v2.0
0 stars 0 forks source link

segfault in pdsh-2.29 read_wcoll() when file == NULL #68

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
The read_wcoll() function says that it permits either of its two parameters to 
be NULL :

/*
 * Read wcoll from specified file or from the specified FILE pointer.
 * (one of the arguments must be NULL).  
 *      file (IN)       name of wcoll file (or NULL)
 *      f (IN)          FILE pointer to wcoll file (or NULL)    
 *      RETURN          new list containing hostnames
 */

but it seems as if this function was not tested with a NULL `file` parameter 
after this strcmp() was added :

    if (strcmp (file, "-") == 0) {
        f = stdin;
        file = NULL;
    }

so effectively read_wcoll() will never permit the `file` (filename) parameter 
to be NULL, because it will crash in strcmp().

I have attached a patch.

Original issue reported on code.google.com by dar...@kulp.ch on 26 Nov 2014 at 7:07

Attachments: