Re: Problem with long subject lines

From: Daniel Stenberg <>
Date: Fri, 6 Aug 1999 09:38:00 +0200 (MET DST)
Message-ID: <>

On Thu, 5 Aug 1999, Paul Haldane wrote:

> current version of hypermail has problems (dies) when it encounters a
> message whose subject is very long (I suspect over 256 characters but
> haven't checked exactly). The following message demonstrates the problem
> for me. I've had a quick look at what I think are the relevant bits of
> code but can't see the problem.

>From printfile.c, the print_main_header() function:

    char title[256];


    ** Assure the title is not longer than 64 characters as is
    ** recommended by the HTML specs. Also, strip off any trailing
    ** whitespace in TITLE so weblint is happy. 

    sprintf(title, "%s: %s", label, rp =convchars(subject));

I really can't tell whether the comment is right or not, but we should anyway do something better than the current way. It is pretty silly that *after* the lines above there is a check that does:

    if (strlen(title) > TITLESTRLEN) {

        title[TITLESTRLEN-1] = '\0';
        rp = title+(TITLESTRLEN-2);


Which is a little late since title may have been overflown already... Besides, if the check were to limit the title, the limit should be enfored before the title is run through convchars(), since convchars() may make the title a whole lot longer due to various replacements that don't show in the actual output but are only to make good HTML.


I took the liberty to fix the immediate problem. It now allows any-length subjects and it no longer overflows any limited length buffer. I've run that test-mail and my hypermail survives! I've commited my change to the CVS repository.

             Daniel Stenberg -
   ech`echo xiun|tr nu oc|sed 'sx\([sx]\)\([xoi]\)xo un\2\1 is xg'`ol
Received on Fri 06 Aug 1999 09:37:07 AM GMT

This archive was generated by hypermail 2.2.0 : Thu 22 Feb 2007 07:33:51 PM GMT GMT