[scponly] Bug Found in scponly-4.6 ("*** glibc detected *** free(): invalid pointer")

Irv Elshoff elshoff at wldelft.nl
Thu Jan 25 06:24:11 EST 2007


Greetings,

I found a bug in scponly 4.6 that causes WinSCP to fail whenever a 
server-side command is executed.  The problem is the statement:

    discard_vector(safeenv);

The argument is a global variable (not allocated), but the function 
tries to free it:

    void discard_vector(char **av)
    {
        char **tmpptr=av;   
        while (*tmpptr!=NULL)
            free(*tmpptr++);
        *free(av);*
    }

which results in an error message from glibc and WinSCP getting mixed up.

My quick and dirty fix is to replace the calls (there are two) with:

    { char **tmpptr=safeenv; while (*tmpptr!=NULL) free(*tmpptr++); }


Cheers,
    Irv.

-------------- next part --------------
HTML attachment scrubbed and removed


More information about the scponly mailing list