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

libbsd



Hi,

in libbsd the function fgetln is implmented like this :
{
    char *line = NULL;
    ssize_t nread;

    nread = getline (&line, len, stream);
    if (nread == -1)
        return NULL;

    /* Get rid of the trailing \0, fgetln does not have it. */
    (*len)--;

    return line;
}

but getline store the allocated size in len, not the line length as it should.

I correct with :
{
    char *line = NULL;
    ssize_t nread;

    nread = getline (&line, len, stream);
    if (nread == -1)
        return NULL;

    /* Get rid of the trailing \0, fgetln does not have it. */
    //(*len)--;
    *len = strlen(line);

    return line;
}

and it works.

Is there a bugzilla or something to report this bug, and to receive a mail if it's corrected ?

Regards,
Jief


Reply to: