-const char jcc_rcs[] = "$Id: jcc.c,v 1.431 2014/10/18 11:31:12 fabiankeil Exp $";
+const char jcc_rcs[] = "$Id: jcc.c,v 1.433 2015/01/24 16:40:37 fabiankeil Exp $";
/*********************************************************************
*
* File : $Source: /cvsroot/ijbswa/current/jcc.c,v $
*
* Function : chunked_body_is_complete
*
- * Description : Figures out wheter or not a chunked body is complete.
+ * Description : Figures out whether or not a chunked body is complete.
*
* Currently it always starts at the beginning of the
* buffer which is somewhat wasteful and prevents Privoxy
{
return CHUNK_STATUS_PARSE_ERROR;
}
- /*
- * Skip "\r\n", the chunk data and another "\r\n".
- * Moving p to either the beginning of the next chunk-size
- * or one byte beyond the end of the chunked data.
- */
- p += 2 + chunksize + 2;
+ /* Move beyond the chunkdata. */
+ p += 2 + chunksize;
+
+ /* There should be another "\r\n" to skip */
+ if (memcmp(p, "\r\n", 2))
+ {
+ return CHUNK_STATUS_PARSE_ERROR;
+ }
+ p += 2;
} while (chunksize > 0U);
*length = (size_t)(p - iob->cur);