don't scan whole files in israd()
This commit is contained in:
parent
ad258d9ad2
commit
d13ff241c5
@ -394,8 +394,11 @@ getheader( /* get header from file */
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
char buf[MAXLINE];
|
char buf[MAXLINE];
|
||||||
|
int n;
|
||||||
|
|
||||||
for ( ; ; ) {
|
/* give up if there are more than 1,000 lines of header, prevents
|
||||||
|
* us scanning entire files when testing for israd */
|
||||||
|
for (n = 0; n < 1000; n++) {
|
||||||
buf[MAXLINE-2] = '\n';
|
buf[MAXLINE-2] = '\n';
|
||||||
if (fgets(buf, MAXLINE, fp) == NULL)
|
if (fgets(buf, MAXLINE, fp) == NULL)
|
||||||
return(-1);
|
return(-1);
|
||||||
@ -412,6 +415,8 @@ getheader( /* get header from file */
|
|||||||
if (f != NULL && (*f)(buf, p) < 0)
|
if (f != NULL && (*f)(buf, p) < 0)
|
||||||
return(-1);
|
return(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user