mirror of
https://github.com/projectdiscovery/nuclei.git
synced 2025-12-17 14:05:28 +00:00
adding breakout after max iterations
This commit is contained in:
parent
dda649773c
commit
882463c462
@ -275,7 +275,16 @@ func (c *Client) readUntil(ctx context.Context, needles ...string) (matched stri
|
||||
var b strings.Builder
|
||||
tmp := make([]byte, 1)
|
||||
|
||||
// Maximum iteration counter to prevent infinite loops
|
||||
maxIterations := 20
|
||||
iterationCount := 0
|
||||
|
||||
for {
|
||||
iterationCount++
|
||||
// if we have iterated more than maxIterations, return
|
||||
if iterationCount > maxIterations {
|
||||
return "", b.String(), nil
|
||||
}
|
||||
// honor context deadline on every read
|
||||
c.setDeadlineFromCtx(ctx, false)
|
||||
_, err := c.rd.Read(tmp)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user