X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=comstack%2Fcomstack.c;h=1488704de5ce7e7853175572799d1a9033cb3cd5;hb=c71d717ada2a9ef730d527f161eb5ba9aa641a9f;hp=a429f87793a4b6bf9833b8df568305a40e3f2bf1;hpb=8195969f51aeb023710b6dd7ae39daaf7d625313;p=yaz-moved-to-github.git diff --git a/comstack/comstack.c b/comstack/comstack.c index a429f87..1488704 100644 --- a/comstack/comstack.c +++ b/comstack/comstack.c @@ -2,7 +2,7 @@ * Copyright (c) 1995-2003, Index Data * See the file LICENSE for details. * - * $Id: comstack.c,v 1.15 2003-10-16 10:18:56 adam Exp $ + * $Id: comstack.c,v 1.16 2003-10-20 18:21:45 adam Exp $ */ #include @@ -129,10 +129,6 @@ int cs_look (COMSTACK cs) int cs_complete_auto(const unsigned char *buf, int len) { - if (!len) - return 0; - if (!buf[0] && !buf[1]) - return 0; if (len > 5 && buf[0] >= 0x20 && buf[0] < 0x7f && buf[1] >= 0x20 && buf[1] < 0x7f && buf[2] >= 0x20 && buf[2] < 0x7f) @@ -142,6 +138,8 @@ int cs_complete_auto(const unsigned char *buf, int len) while (i <= len-4) { + if (i > 8192) + return i; /* do not allow more than 8K HTTP header */ if (buf[i] == '\r' && buf[i+1] == '\n') { i += 2; @@ -153,7 +151,6 @@ int cs_complete_auto(const unsigned char *buf, int len) { int chunk_len = 0; i += 2; - #if 0 /* debugging */ if (i = (i+2)+ content_len)