Fix (CWE-118): Implicit memory aliasing in for loop.
This commit is contained in:
parent
e651a7495f
commit
9f49a689fd
@ -473,7 +473,7 @@ func buildExerciceFlags(i Importer, exercice *fic.Exercice, exceptions *CheckExc
|
|||||||
|
|
||||||
// Ensure flag ID is unique
|
// Ensure flag ID is unique
|
||||||
for _, ok := flags[flag.Id]; ok; _, ok = flags[flag.Id] {
|
for _, ok := flags[flag.Id]; ok; _, ok = flags[flag.Id] {
|
||||||
errs = append(errs, NewFlagError(exercice, &flag, nline+1, fmt.Errorf("identifier already used (%d), using a random one.", flag.Id)))
|
errs = append(errs, NewFlagError(exercice, ¶ms.Flags[nline], nline+1, fmt.Errorf("identifier already used (%d), using a random one.", flag.Id)))
|
||||||
flag.Id = rand.Int63()
|
flag.Id = rand.Int63()
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -491,7 +491,7 @@ func buildExerciceFlags(i Importer, exercice *fic.Exercice, exceptions *CheckExc
|
|||||||
// Read dependency to flag
|
// Read dependency to flag
|
||||||
for _, nf := range flag.NeedFlag {
|
for _, nf := range flag.NeedFlag {
|
||||||
if len(nf.Theme) > 0 {
|
if len(nf.Theme) > 0 {
|
||||||
errs = append(errs, NewFlagError(exercice, &flag, nline+1, fmt.Errorf("dependancy on another scenario is not implemented yet.")))
|
errs = append(errs, NewFlagError(exercice, ¶ms.Flags[nline], nline+1, fmt.Errorf("dependancy on another scenario is not implemented yet.")))
|
||||||
}
|
}
|
||||||
newFlag.FlagsDeps = append(newFlag.FlagsDeps, nf.Id)
|
newFlag.FlagsDeps = append(newFlag.FlagsDeps, nf.Id)
|
||||||
}
|
}
|
||||||
|
@ -28,10 +28,10 @@ type uTeamRegistration struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func registrationProcess(id string, team *fic.Team, members []fic.Member, team_id string) {
|
func registrationProcess(id string, team *fic.Team, members []fic.Member, team_id string) {
|
||||||
for _, m := range members {
|
for i, m := range members {
|
||||||
// Force Id to 0, as it shouldn't have been defined yet
|
// Force Id to 0, as it shouldn't have been defined yet
|
||||||
m.Id = 0
|
m.Id = 0
|
||||||
if err := team.GainMember(&m); err != nil {
|
if err := team.GainMember(&members[i]); err != nil {
|
||||||
log.Println("[WRN] Unable to add member (", m, ") to team (", team, "):", err)
|
log.Println("[WRN] Unable to add member (", m, ") to team (", team, "):", err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -35,9 +35,9 @@ func (w *Walker) fetchTeams() error {
|
|||||||
w.TeamBindings = map[string]*AirbusTeam{}
|
w.TeamBindings = map[string]*AirbusTeam{}
|
||||||
|
|
||||||
for tid, team := range w.Teams {
|
for tid, team := range w.Teams {
|
||||||
for _, t := range teams {
|
for i, t := range teams {
|
||||||
if team.Name == t.Name || team.ExternalId == t.Name {
|
if team.Name == t.Name || team.ExternalId == t.Name {
|
||||||
w.TeamBindings[tid] = &t
|
w.TeamBindings[tid] = &teams[i]
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user