modified search_header_end() and use the value of n instead of strlen(p)

This commit is contained in:
SJ 2012-07-23 11:42:58 +02:00
parent 971d43020c
commit e6f3877378
2 changed files with 6 additions and 1 deletions

5
CREDITS Normal file
View File

@ -0,0 +1,5 @@
The FSF.hu Foundation (http://fsf.hu/) supported and donated piler within the
"Free Software Application 2011 project." (http://fsf.hu/2011/09/27/szabad-szoftver-palyazat-2011/)
Nemeth Adam reviewed the web interface, and gave lots of useful hints and insights to
improve the web ui of piler.

View File

@ -20,7 +20,7 @@
int search_header_end(char *p, int n){ int search_header_end(char *p, int n){
int hdr_len=0; int hdr_len=0;
if(strlen(p) < 5) return hdr_len; if(n < 5) return hdr_len;
for(; *p; p++){ for(; *p; p++){
if(hdr_len < n-2 && *p == '\n' && *(p+1) == '\r' && *(p+2) == '\n'){ hdr_len += 3; return MAX(hdr_len, n); } if(hdr_len < n-2 && *p == '\n' && *(p+1) == '\r' && *(p+2) == '\n'){ hdr_len += 3; return MAX(hdr_len, n); }