Skip to content

Commit

Permalink
fix: slice out of range by @robfig/cronrobfig/pull/482
Browse files Browse the repository at this point in the history
  • Loading branch information
fufuok committed Mar 24, 2023
1 parent dbb6ed5 commit c43bc33
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,10 @@ func (p Parser) Parse(spec string) (Schedule, error) {
if strings.HasPrefix(spec, "TZ=") || strings.HasPrefix(spec, "CRON_TZ=") {
var err error
i := strings.Index(spec, " ")
if i < 0 {
return nil, fmt.Errorf("invalid spec string")
}

eq := strings.Index(spec, "=")
if loc, err = time.LoadLocation(spec[eq+1 : i]); err != nil {
return nil, fmt.Errorf("provided bad location %s: %v", spec[eq+1:i], err)
Expand Down

0 comments on commit c43bc33

Please sign in to comment.