mirror of
https://github.com/projectdiscovery/nuclei.git
synced 2025-12-17 18:05:27 +00:00
fix: prevent nil pointer dereference on context cancellation (#6085)
This commit is contained in:
parent
357fe9efa7
commit
1874d5b900
@ -107,6 +107,7 @@ func (e *Engine) executeTemplateSpray(ctx context.Context, templatesList []*temp
|
||||
// wp is workpool that contains different waitgroups for
|
||||
// headless and non-headless templates
|
||||
wp := e.GetWorkPool()
|
||||
defer wp.Wait()
|
||||
|
||||
for _, template := range templatesList {
|
||||
select {
|
||||
@ -135,7 +136,6 @@ func (e *Engine) executeTemplateSpray(ctx context.Context, templatesList []*temp
|
||||
e.executeTemplateWithTargets(ctx, tpl, target, results)
|
||||
}(template)
|
||||
}
|
||||
wp.Wait()
|
||||
return results
|
||||
}
|
||||
|
||||
@ -143,6 +143,7 @@ func (e *Engine) executeTemplateSpray(ctx context.Context, templatesList []*temp
|
||||
func (e *Engine) executeHostSpray(ctx context.Context, templatesList []*templates.Template, target provider.InputProvider) *atomic.Bool {
|
||||
results := &atomic.Bool{}
|
||||
wp, _ := syncutil.New(syncutil.WithSize(e.options.BulkSize + e.options.HeadlessBulkSize))
|
||||
defer wp.Wait()
|
||||
|
||||
target.Iterate(func(value *contextargs.MetaInput) bool {
|
||||
select {
|
||||
@ -158,7 +159,6 @@ func (e *Engine) executeHostSpray(ctx context.Context, templatesList []*template
|
||||
}(value)
|
||||
return true
|
||||
})
|
||||
wp.Wait()
|
||||
return results
|
||||
}
|
||||
|
||||
|
||||
@ -163,6 +163,7 @@ func (e *Engine) executeTemplatesOnTarget(ctx context.Context, alltemplates []*t
|
||||
// headless and non-headless templates
|
||||
// global waitgroup should not be used here
|
||||
wp := e.GetWorkPool()
|
||||
defer wp.Wait()
|
||||
|
||||
for _, tpl := range alltemplates {
|
||||
select {
|
||||
@ -210,5 +211,4 @@ func (e *Engine) executeTemplatesOnTarget(ctx context.Context, alltemplates []*t
|
||||
results.CompareAndSwap(false, match)
|
||||
}(tpl, target, sg)
|
||||
}
|
||||
wp.Wait()
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user