Skip to content

Commit

Permalink
ext/vulnsrc/oracle: ensure flag is largest elsa
Browse files Browse the repository at this point in the history
If the Oracle Linux directory is ever in the wrong order, this should
ensure that the updaterFlag is always set the latest ELSA value.
  • Loading branch information
jzelinskie committed Apr 27, 2017
1 parent 0160ef6 commit 09cbfe3
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion ext/vulnsrc/oracle/oracle.go
Original file line number Diff line number Diff line change
Expand Up @@ -174,14 +174,23 @@ func (u *updater) Update(datastore database.Datastore) (resp vulnsrc.UpdateRespo
// Set the flag if we found anything.
if len(elsaList) > 0 {
resp.FlagName = updaterFlag
resp.FlagValue = strconv.Itoa(elsaList[len(elsaList)-1])
resp.FlagValue = strconv.Itoa(largest(elsaList))
} else {
log.Debug("no Oracle Linux update.")
}

return resp, nil
}

func largest(list []int) (largest int) {
for _, element := range list {
if element > largest {
largest = element
}
}
return
}

func (u *updater) Clean() {}

func parseELSA(ovalReader io.Reader) (vulnerabilities []database.Vulnerability, err error) {
Expand Down

0 comments on commit 09cbfe3

Please sign in to comment.