fix: can.fuzz now expects an hexadecimal frame id (thanks musafir)

This commit is contained in:
Simone Margaritelli 2024-08-27 09:25:40 +02:00
commit 1c56622cde
2 changed files with 5 additions and 4 deletions

View file

@ -16,8 +16,9 @@ func (mod *CANModule) Fuzz(id string) error {
rncSource := rand.NewSource(time.Now().Unix())
rng := rand.New(rncSource)
// let's try as number first
frameID, err := strconv.Atoi(id)
// let's try as an hex number first
// frameID, err := strconv.Atoi(id)
frameID, err := strconv.ParseUint(id, 16, 32)
dataLen := 0
frameData := ([]byte)(nil)
@ -32,7 +33,7 @@ func (mod *CANModule) Fuzz(id string) error {
idx := rng.Intn(len(fromSender))
selected := fromSender[idx]
mod.Info("selected %s > (%d) %s", id, selected.ID, selected.Name)
frameID = int(selected.ID)
frameID = uint64(selected.ID)
} else {
return err
}