Merge pull request #378 from jzelinskie/oracle-update-fix

ext/vulnsrc/oracle: ensure flag is largest elsa
This commit is contained in:
Jimmy Zelinskie 2017-04-27 19:10:59 -04:00 committed by GitHub
commit b02714c1ae

View File

@ -174,7 +174,7 @@ func (u *updater) Update(datastore database.Datastore) (resp vulnsrc.UpdateRespo
// Set the flag if we found anything. // Set the flag if we found anything.
if len(elsaList) > 0 { if len(elsaList) > 0 {
resp.FlagName = updaterFlag resp.FlagName = updaterFlag
resp.FlagValue = strconv.Itoa(elsaList[len(elsaList)-1]) resp.FlagValue = strconv.Itoa(largest(elsaList))
} else { } else {
log.Debug("no Oracle Linux update.") log.Debug("no Oracle Linux update.")
} }
@ -182,6 +182,15 @@ func (u *updater) Update(datastore database.Datastore) (resp vulnsrc.UpdateRespo
return resp, nil return resp, nil
} }
func largest(list []int) (largest int) {
for _, element := range list {
if element > largest {
largest = element
}
}
return
}
func (u *updater) Clean() {} func (u *updater) Clean() {}
func parseELSA(ovalReader io.Reader) (vulnerabilities []database.Vulnerability, err error) { func parseELSA(ovalReader io.Reader) (vulnerabilities []database.Vulnerability, err error) {