trinity-devel@lists.pearsoncomputing.net

Message: previous - next
Month: November 2011

Re: [trinity-devel] Kmailrc File Type.

From: Laurent Dard <f.couperin@...>
Date: Sat, 19 Nov 2011 22:52:20 +0100
> I believe the bug is here. There is a length limit that troubles
> konqueror: if a line contains more than 301 bytes, the file is wrongly
> identified.

kdelibs/kio/kio/kmimemagic.cpp:2O10:
    /* Now, look whether the file consists of lines of
     * "reasonable" length. */

    for (i = 0; i < nbytes;) {
        cp = (unsigned char *) memchr(buf, '\n', nbytes - i);
        if (cp == NULL) {
            /* Don't fail if we hit the end of buffer. */
            if (i + TEXT_MAXLINELEN >= nbytes)
                break;
            else
                return 0;
        }
        if (cp - buf > TEXT_MAXLINELEN)
            return 0;
        i += (cp - buf + 1);
        buf = cp + 1;
    }

An here is THE BUG:
kdelibs/kio/kio/kmimemagic.cpp:1992:
#define TEXT_MAXLINELEN 300

Now, what's the solution? Is it good to define a maximum length?
Which one?

-- 
Laurent Dard