No subject


Fri Feb 17 02:32:51 UTC 2012


/*  $Id: art.c,v 1.235 2004/06/11 05:09:48 rra Exp $            
[...]

static void
ARTparsebody(CHANNEL *cp)
{
    struct buffer *bp = &cp->In;
    ARTDATA *data = &cp->Data;
    size_t i;

    for (i = cp->Next; i < bp->used; i++) {
        if (bp->data[i] == '\0')
            ARTerror(cp, "Nul character in body");
        if (bp->data[i] == '\n')
            data->LFwithoutCR++;
        if (bp->data[i] != '\r')
            continue;

        /* Saw \r.  We're just scanning for the article terminator, so if we
           don't have at least five characters left, we can save effort and
           stop now. */
        if (bp->used - i < 5) {
            cp->Next = i;
            return;
        }
        if (memcmp(&bp->data[i], "\r\n.\r\n", 5) == 0) {
            if (cp->State == CSeatarticle)
                cp->State = CSgotlargearticle;
            else
                cp->State = CSgotarticle;
            cp->Next = i + 5;
            data->Lines++;
            return;
***     } else if (bp->data[i + 1] == '\n') {
***         data->Lines++;
        } else {
            data->LFwithoutCR++;

Shouldn't there i be incremented, else you will log a LF without
CR for each body line.

Also (haven't checked further the code) : are we sure that
bp->data[i + 1] never goes beyond the bounds ?

A patch could be :

*** art.c.orig  Sat Jun 26 16:52:33 2004
--- art.c       Sat Jun 26 16:58:52 2004
***************
*** 951,956 ****
--- 951,957 ----
              data->Lines++;
              return;
          } else if (bp->data[i + 1] == '\n') {
+           i++;
              data->Lines++;
          } else {
              data->LFwithoutCR++;

-- 
Christophe Wolfhugel -+- wolf at oleane.net -+- France Telecom Transpac
Direction de l'Internet et de l'hébergement
Téléphone : +33 1 4612 6645


More information about the inn-workers mailing list