[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

19990629: cfltbop.c bug



There is a small bug in cfltbop.c which causes an array error:

/*
 *      Extract the filename from the end of the path.
 */
        done = G_FALSE;
        lenname = strlen (pathfile);
        cpos = lenname;
        while ( (done == G_FALSE) && (cpos >= 0) ) {
            cpos--;
            if ( pathfile[cpos] == '/' || pathfile[cpos] == ':' ) {
                done = G_TRUE;
            }
        }


The comparison (cpos >= 0) should be (cpos > 0).
cpos is decremented inside the while loop and if
allowed to be equal to zero, will result in pathfile[cpos].

This error is a problem with HPUX-11.0.

Steve Chiswell
Unidata User Support